Message from JavaScript discussions

November 2020

— Https://www.youtube.com/watch?v=3APDDtxohBU

— 

Can someone kindly explain whats happening here...cuz i dont understand.

function countup(n) {
if (n < 1) {
return [];
} else {
const countArray = countup(n - 1);
countArray.push(n);
return countArray;
}
}
console.log(countup(5)); // [ 1, 2, 3, 4, 5 ]

— You call recursively countup until n is 0 to return an empty array. Then it will go up in the call stack pushing the value of n in each call

Message permanent page

— Thank you

— 8

— Het
I want to show a floating triangle in a page that when user puts cursor on it , it stops floating .
How can I do this ?

Message permanent page

— What do you mean, stop floating?

— I mean Ittt stops in that point
it doesn't move anymore

— *it stops

— Replace it with cycle to get understanding🤤 any recursion is a cycle

— Do you have an example

— Cycles often mess up understanding of recursive functions