Why is my code not creating an array of [0, 1, 2] when I pass the number 3 as a parameter?
const array = [0];
const increment = (num) => {
if (num > 0) {
increment(num - 1);
array.push(num);
}
return;
};
console.log(array);
increment(3);