[SOLVED] How can i make while statement work in function?

[SOLVED] How can i make while statement work in function?
0.0 0

#1

Im trying this code out but cant seem to make it work.

function myFunction(num) {

   var total = 0;
   var i = 0;
   while (i < num) {
     total.push(i);
     i++;
   }
   return total;
}
myFunction(20);

EDIT: Nevermind, i figured it out lol.