Basic JavaScript: Use Recursion to Create a CountdownPassed (watch this 1.75 x speed)

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Thank you for your huge effort to make this cristal clear .

omerehsan
Автор

It's 5-1 which equals to 4. I don't understand how 5 still get pushed through for the countUp example.

MrNate
Автор

I dont like admitting i'm lazy, but when the directions say to get paper and write it all out, my instinct is to say NO. LOL. Thank you for doing the hard work. This helped ALOT!!

Matthew-rshb
Автор

This was so helpful! Thank you very much! Appreciate you!

LibraryOfTheOligarchs
Автор

Cool explanation, I did some thinking myself, I just couldn't find the reason why the processing backtracked after pushing the empty array due to the base case...my assumption is, after seeing your reasoning - may be the push operations are kind of stored and revisited, that is, after returning results after the base case has run. Try doing console.log (n) at the beginning of else statement and console.log(array) after the push statement..cheers!

derrickmbarani
Автор

Thank you so much! I spent a couple of hours trying to understand that. Searched on internet, asked friends, watched some videos but only your explanation made sense to me.

tomguine
Автор

this was really helpful, thank you and keep going.

arabdrops
Автор

well explain, but one thing i got confuse is why .push() go back to add up

andsdf
Автор

Great overall video. Understood the syntax for the Fibonacci recursion but this example tripped me up as well. At 15:20 the "terminal" tells you why it doesn't work. You were console logging countup, which in that code, is not defined. If you have console logged countdown, more specifically, if you have written console.log( countdown(5) ); your code would have worked. The bottom most console.log was your only problem which is why when you deleted it your code passed. Once again, great video. You helped me really parse out this example.

calmwinds
Автор

function rangeOfNumbers(startNum, endNum) {
if(startNum>endNum) {
return [];
}
else if(startNum===endNum) {
return [startNum];
}
else {
console.log(startNum)
const numArray=rangeOfNumbers(startNum+1, endNum);
numArray.push(startNum);
console.log(numArray);
return numArray;
}
};
console.log(rangeOfNumbers(2, 6));


//Same logic different problem statement

derrickmbarani
visit shbcf.ru