Add Five numbers in table with For Loop

Hello,
I would like add numbers 5 through 0 to myArray with a for loop.
I expect this result: [5,4,3,2,1,0]

function myFun() {
        var myArray = [];
        for (var i = 5; i >= 0; i--) {
          myArray.push[i];
        }
        console.log(myArray);
      }

What’s wrong ?

I found the mistake:

myArray.push(i);
1 Like

Good job figuring it out! Happy coding.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.