File tree Expand file tree Collapse file tree 1 file changed +44
-18
lines changed Expand file tree Collapse file tree 1 file changed +44
-18
lines changed Original file line number Diff line number Diff line change 88 </ body >
99 < script >
1010function clunk ( times ) {
11- var num = times ;
12- while ( num > 0 ) {
13- console . log ( "clunk" ) ;
14- clunkCounter = clunkCounter + 1 ;
15- num = num - 1 ;
16- }
11+ var num = times ;
12+ while ( num > 0 ) {
13+ display ( "clunk" ) ;
14+ num = num - 1 ;
15+ }
1716}
1817
1918function thingamajig ( size ) {
20- var facky = 1 ;
21- if ( size == 0 ) {
22- console . log ( "clank" ) ;
23- } else if ( size == 1 ) {
24- console . log ( "thunk" ) ;
25- } else {
26- while ( size > 1 ) {
27- facky = facky * size ;
28- size = size - 1 ;
29- }
30- clunk ( facky ) ;
31- }
19+ var facky = 1 ;
20+ clunkCounter = 0 ;
21+ if ( size == 0 ) {
22+ display ( "clank" ) ;
23+ } else if ( size == 1 ) {
24+ display ( "thunk" ) ;
25+ } else {
26+ while ( size > 1 ) {
27+ facky = facky * size ;
28+ size = size - 1 ;
29+ }
30+ clunk ( facky ) ;
31+ }
32+ }
33+
34+ function display ( output ) {
35+ console . log ( output ) ;
36+ clunkCounter = clunkCounter + 1 ;
3237}
3338var clunkCounter = 0 ;
39+ thingamajig ( 0 ) ;
40+ console . log ( clunkCounter ) ;
41+
42+ clunkCounter = 0 ;
43+ thingamajig ( 1 ) ;
44+ console . log ( clunkCounter ) ;
45+
46+ clunkCounter = 0 ;
47+ thingamajig ( 2 ) ;
48+ console . log ( clunkCounter ) ;
49+
50+ clunkCounter = 0 ;
51+ thingamajig ( 3 ) ;
52+ console . log ( clunkCounter ) ;
53+
54+ clunkCounter = 0 ;
55+ thingamajig ( 4 ) ;
56+ console . log ( clunkCounter ) ;
57+
58+ clunkCounter = 0 ;
3459thingamajig ( 5 ) ;
3560console . log ( clunkCounter ) ;
61+
3662 </ script >
3763</ body >
3864</ html >
You can’t perform that action at this time.
0 commit comments