Jump to content

Confused


tmoflash

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
Link to comment
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.  

Stef

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...