Jump to content
Killersites Community
Sign in to follow this  


Recommended Posts

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 by tmoflash

Share this post

Link to post
Share on other sites
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.  


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this