Thanks for the suggestion but how am I suppose to put the loop such that it produces the required result of[5, 4,3,2,1,0] because I tried many options but it isn’t working.
you have i starting at 5 and then decreasing - you need a condtion that is true for all the numbers you want in the array, and that become false when you want to stop it
You are using push() to throw numbers at the end of the array, how about replacing push() with something that throws numbers at the beginning of the array?