What should I do in this case? Should I spend some more time practicing recursions and other things I don’t have a solid grip on before moving on to the ES6 section. I heard it was much harder than the first basic section. Basic section was easy for me till I reached about 80% or so. The record collection, profile lookup etc was not that easy. And the recursion sections’ challenges were very hard. The second last one at 98% was the hardest. Had to spend so much time trying to understand it was so relieved when I finally understood.
In the very last challenge we were told to create a range of numbers, I wrote the code and to my surprise passed the test(I had a very vague idea of what I was doing just was trying to make it like the previous challenge’s code)
Here’s my code. I was surprised that it passed the test then I spend next 20 minutes trying to figure out why it worked(still I can’t figure it out by just looking at it, have to spend some time with paper and a pen to sketch out the solution using lines and boxes and thus I am wondering whether I am ready to handle ES6 section or whether I should spend more time in the basic section.
function rangeOfNumbers(startNum, endNum) {
if(startNum==endNum){
return [startNum];
}
else{
var array=[startNum];
var array=rangeOfNumbers(startNum,endNum-1);
array.push(endNum);
return array;
}
};