File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ .idea
3
+ workspace.xml
4
+ npm-debug.log
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ function trampoline ( boundFunc ) {
4
+ while ( boundFunc && boundFunc instanceof Function ) {
5
+ boundFunc = boundFunc ( ) ;
6
+ }
7
+ return boundFunc ;
8
+ }
9
+
10
+ var loopCount = 100000 ;
11
+
12
+
13
+ function loopit ( i ) {
14
+ function looper ( i ) {
15
+ if ( i < loopCount ) {
16
+ console . log ( `${ i + 1 } /${ loopCount } ` ) ;
17
+ return looper . bind ( null , i + 1 ) ;
18
+ }
19
+ }
20
+ return trampoline ( looper . bind ( null , i ) ) ;
21
+ }
22
+
23
+ loopit ( 0 ) ;
24
+
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " callstack-recursion" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " echo \" Error: no test specified\" && exit 1"
8
+ },
9
+ "author" : " " ,
10
+ "license" : " ISC"
11
+ }
You can’t perform that action at this time.
0 commit comments