tmoflash Posted March 21, 2018 Report Share Posted March 21, 2018 (edited) In the Javascript language everything is case sensitive and also camel case must also be used. why is "onclick" not using camel case? The other thing I do not understand is reading from top to bottom. I understand that the browser reads JS from top to bottom and if an item is declared after the JS script it will not be recognized. However, in this piece of code why did it skip over end not trigger. My guess is when the browser read the script and put into memory it knew that it was false based on the Boolean value? if(notRunning) { animation = setInterval(discoSquare, 100); notRunning = false; } else { alert("Sorry, already running.") } Edited March 21, 2018 by tmoflash Quote Link to comment Share on other sites More sharing options...
administrator Posted March 21, 2018 Report Share Posted March 21, 2018 1 hour ago, tmoflash said: why is "onclick" not using camel case? Because the developer decided to make it that way. Not all things are obviously logical. And sometimes they are not logical at all! The key to the conditional you listed above, is the value held in the variable 'notRunning' .... it did not trigger because 'notRunning' held a value of false. Stef Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.