Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
JavaScript currently supports the following eleven statements. Note that some of these -- such as comment, var, and new -- aren't bona fide statements, but they are often treated as such. They are included in this discussion for the sake of completeness.
A few of the statements offered in Java are notably lacking in JavaScript. This includes the switch statement, as well as all forms of error-trapping statements (such as catch and throw). JavaScript keeps these statements as reserved words, and perhaps in some future version, they will be implemented.
// This is a simple comment
// This is another comment that spans more than one line. Though the comment wraps to the second line, the first line ends with a "soft return" in the text editing program. No hard return character is inserted.
You can place the // comment characters anywhere on a line. JavaScript will treat all the text on that line after the // as a comment.
MyVariable="This is a test" // assigns text variable MyVariable
Comments are ignored when the script is played, so they do not greatly affect the speed of execution. However, lots of comments increase the file size of scripts and take longer to download to the user's computer over a dial-up Internet connection. For best results, limit comments in JavaScript programs to brief, single lines.
When writing long comments it's better to use the alternate commenting characters /* and */. Text between these characters is treated as a comment. Alternatively, you can start each line with the // comment characters.
// This section checks to see if the Enter key is pressed, // then continues on
or
/* This section checks to see if the Enter key is pressed, then continues on */
The break statement is most commonly used to prematurely end a for loop. For example: