I'm a total beginner in JS. Now trying to handle arrays
question: why the code below doesn't work. The aim is to make a function that adding the variable to the arrays but the outcome is still undefined. I hot stucked.
var b = []; var n = 1; function name() { b.push(n); console.log(b); } console.log(b);