+ 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

28th Sep 2018, 3:16 AM
George S Mulbah II
George S Mulbah II - avatar
3 Answers
+ 5
Janning⭐ but name is not on JavaScript list of reserved key words
28th Sep 2018, 1:43 PM
George S Mulbah II
George S Mulbah II - avatar
28th Sep 2018, 3:48 AM
Janning⭐
Janning⭐ - avatar
0
"You should also avoid using the name of JavaScript built-in objects, properties, and methods:"
28th Sep 2018, 8:01 PM
Janning⭐
Janning⭐ - avatar