SWEngineer Posted July 22, 2010 Share Posted July 22, 2010 In the "Head First Javascript" book, it mentions that this is an illegal name: alarm_statusIsn't it legal to use underscores?Thanks. Link to comment Share on other sites More sharing options...
ShadowMage Posted July 22, 2010 Share Posted July 22, 2010 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 More sharing options...
End User Posted July 22, 2010 Share Posted July 22, 2010 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 More sharing options...
ApocalypeX Posted July 22, 2010 Share Posted July 22, 2010 In the "Head First Javascript" book, it mentions that this is an illegal name: alarm_statusIsn't it legal to use underscores?Thanks.What's the surrounding code? Link to comment Share on other sites More sharing options...
Ingolme Posted July 22, 2010 Share Posted July 22, 2010 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 More sharing options...
justsomeguy Posted July 22, 2010 Share Posted July 22, 2010 Looks perfectly cromulent to me. Link to comment Share on other sites More sharing options...
SWEngineer Posted July 23, 2010 Author Share Posted July 23, 2010 Thanks a lot everyone, I think I should note that to the author. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.