I want to make a function that can add numbers from 1 to more into the empty array. Why my function won’t take the length of new array’s length 1, and add 2 into the new array?
var output = ;
function fizzBuzz(){
output.push(output.length + 1); console.log(output);
}
fizzBuzz();
hello and welcome back to fcc forum
its actually doing what you are tying to do here
function fizzBuzz(){ output.push(output.length + 1); console.log(output); } fizzBuzz(); VM38:6 [1] // output
unless there is something else that you want this code to do?!
happy coding
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.