function() {console.log(i);}
is an expression that evaluates a value, which is a function that registers i
.
funcs.push
is a function that adds a value to an array.
Enter ()
after calling this function by function.
funcs.push(some_value)
calls the push
function and passes some_value
as the value placed in the array.
funcs.push(function() {console.log(i);})
adds the function to the array.
The value of funcs[0]
becomes this function.
Enter ()
after calling this function by function.
funcs[0]()
calls the function, which is the first value in the array.
source share