+ 2
Js question
why this recursive function does not show me any out put in console? function reverse(a) { if (!a.length) return a; return reverse(a.slice(1)).concat(a[0]) } var a=[3,5,7,6,8]; console.log(reverse(a));
10 Antworten
+ 3
Ai.dz Just an interesting fact :
Do you know about the reverse method?
var a=[3,5,7,6,8];
console.log(a.reverse()); // 8,6,7,5,3
Would give you the same result :))
+ 2
Ai.dz That's really awesome :))
Another challenge you can take is implementing the sort method :))
+ 1
Did you mean in SoloLearn
Because I have tried it now
It gives output
+ 1
In SoloLearn
+ 1
If you want to make it outside just link it
+ 1
Hey Brother Rahim,
yes, I know that there are already made methods, but I was just trying to do it my self using the recursion ^^
Thank you ^^
0
I am trying it in soloLearn actually.
where did you try it?
0
oh yeah I just tried it using web browser, yup it worked
Thank you Brother ^^
0
I am kinnda beginner, but yeah it looks a good idea to try ^^