+ 1
I dont understand this...can anyone help me out wid this question's answer!!?the answer is 4 bt don't knw how!!?
function f(x){ if x==4 return 4; else return f(x+1); } alert(f(1));
4 Réponses
+ 2
It's recursion here => a function which calls itself until the base case is reached (base case is defined => x==4). So steps are f(2)=>f(3)=> and finally when x==4 => function returns 4.
0
Thank u so much TheWh¡teCat 😊
0
You are welcome Christo Sam 😉