Jump to content

Is this an illegal name in Javascript? Why?


SWEngineer

Recommended Posts

Yes, it is legal to use underscores in variable names. I just did a quick test to prove it:var a_test = "This is a test";alert(a_test);Perhaps alarm_status is a reserved keyword or something? It doesn't sound familiar but I'm far from an expert in JavaScript.

Link to comment
Share on other sites

In the "Head First Javascript" book, it mentions that this is an illegal name: alarm_status
I believe that is a perfectly legal name to use for a variable or function.
Link to comment
Share on other sites

To my knowledge, there are not reserved keywords in Javascript that contain underscores, so alarm_status should be perfectly valid for a variable name.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...