+ 1
function abc(a) { return (function(y){ return y+1; }) (++a)+a; } alert(abc(2));
How come the output 7 is possible for this?i need exaplaination .
2 Respostas
+ 3
//You put an argument a as 2. a gets pre-incremented by one and so now equals 3. You add up 3+3 and get 6. But you asked the function to return the result plus one (return y+1) and so you receive 7 in the end.
answered by: @kuba
https://www.sololearn.com/Discuss/482453/?ref=app
0
Tqsm @Shudarshan Rai 👑