+ 4
you need to see this
JavaScript playground will not just allow name to be a function the below code prove I don't know why <html> <head> </head> <body> <script> function name(){ alert("hi there"); }; </script> <button onclick="name();">click</button> </body> </html> //return errors saying name is not a function if I change the word it work but not with name ..why is name a keyword I don't just known please help
3 Answers
+ 5
Janningâ but name is not on JavaScript list of reserved key words
0
"You should also avoid using the name of JavaScript built-in objects, properties, and methods:"