File tree 3 files changed +24
-1
lines changed 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ function reverseStringRecursive ( str : string ) : string {
2
+ if ( str . length === 0 ) return "" ;
3
+
4
+ return reverseStringRecursive ( str . substring ( 1 ) ) + str . charAt ( 0 ) ;
5
+ }
6
+
7
+ function printReverseString ( str : string ) {
8
+ console . log ( str , '–>' , reverseStringRecursive ( str ) ) ;
9
+ }
10
+
11
+
12
+ //---------------------------------------------------------------------
13
+ // ---------- MAIN PROGRAM ----------
14
+ //---------------------------------------------------------------------
15
+ if ( import . meta. main ) {
16
+
17
+ printReverseString ( "Hello World!" ) ;
18
+ printReverseString ( "C0mp!ex1tY" ) ;
19
+ printReverseString ( "Avatar: The Last Airbender" ) ;
20
+
21
+ // RUN: deno run Playground/Challenges/Recursion/ReverseString.ts
22
+ }
Original file line number Diff line number Diff line change 1
- // RUN: deno run Playground/Classes_Demo .ts
1
+ // RUN: deno run Playground/Demos/Classes_101 .ts
2
2
3
3
class Bender {
4
4
protected name : string ;
Original file line number Diff line number Diff line change
1
+ // RUN: deno run Playground/Demos/Objects_101.ts
1
2
2
3
console . log ( '------------------------- Episode 1 -------------------------' ) ;
3
4
const episode1 = {
You can’t perform that action at this time.
0 commit comments