I don't understand this code. Not from lack of trying. From a challenge question. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I don't understand this code. Not from lack of trying. From a challenge question.

https://code.sololearn.com/WnlTBaPO3UO5/?ref=app

25th Jun 2018, 12:36 PM
Timothy Arundell
2 Answers
+ 5
var a = (function func(num){ if(num==0) return 1; return 1 + func(num-1); })(3); a func(3) 1 + func(2) 1 + (1 + func(1)) 1 + (1 + (1 + func(0))) 1 + (1 + (1 + 1)) 4
25th Jun 2018, 12:55 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Thank You. simplified beautifully.
25th Jun 2018, 1:44 PM
Timothy Arundell