Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Multiple words are not separated with underscores as they might be in some other programming language. Functions are named the same way, or methods if they're in an object. Now, these are typically multiple words for clarity and often in a loose verb noun format. Think of the way that we work with the DOM: createElement, appendChild, getElementById. When we're working with objects, the convention here is to also capitalize the first word.
If there is one statement after the if and the condition, it behaves as if there are curly braces around it. But, as in other C-based languages, it's a really bad idea to do this, because later on it's super easy to add a line of code to this. And when you read this code what you think you're getting is this kind of block, where if x is more than 500 we're going to execute these two lines, but if we left the braces off, what we're actually getting is this.
If the condition is true, we will pop up the alert and we will always then go ahead and reset everything. And these kind of bugs can be a real pain to recognize, so always use the curly braces, even for one-line blocks. Now, another general rule here is even though you don't have to define your functions before you call them--so, for example, here I've got one function called some function that called other function, and other function is nicely defined after it in our code file-- the preference and the best practice is to define your functions before they are called.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.