var name = ['a', 'b', 'c'];
name.push('d');
There was an error doing this.
name.push is not a function
However, there was no problem because the variable name was changed from name
to a
as follows.
var a = ['a', 'b', 'c'];
a.push('d');
Just in case
Through JavaScript Variable name Validator
I checked if name
is a variable that should not be used, but it was okay.
Why is it like this?
Hello.
I tried executing the code in both cases, but there is no problem. In fact, the variable name name doesn't matter at all. You can also check that there is no problem with the browser console or running the code in the body. Maybe it's an environmental problem.
© 2024 OneMinuteCode. All rights reserved.