- Case Sensitivity:
- Uppercase and lowercase letters are unique characters! (myday vs. myDay vs. MyDay)
- Enter/Return Key:
- Individual statements should be typed [completely] on a single line, or error(s) may result.
- JavaScript Is Not Java:
- JavaScript is an object-based scripting language (built-in & extensible objects) developed by Netscape Corporation, which cannot run as a stand-alone programming language. Variable types do not need to be declared (loose typing). It is event driven, triggered by various actions such as a user clicking buttons, entering text, moving the mouse, etc.
- Java is an object-oriented programming language (hierarchical objects) developed by Sun Microsystems, which can be used to create stand-alone applications (i.e. Applets). Variable types must be declared (strong typing). It must be compiled before being executed/run.
- Naming Conventions:
- Function and Variable names must begin with a letter or the underscore character. Use meaningful and descriptive words; do not use hyphens, punctuation marks, nor spaces in names. It is common to combine two or three words adjacent to each other, capitalizing only the first character of the second and/or third words as with "theDay" and "theNewDay".
- Quote Marks:
- It does not matter if single-quote marks ( ' ) or double-quote marks ( " ) are used, but pairs must match. Albeit curly/smart quote marks ( ) ( ) will cause JavaScript to fail.
- Reserved Words:
- Certain words are used to achieve specific results, therefore they cannot be used for variable nor function names (see text for a complete list). Although it may be possible to use some by changing various characters to uppercase or lowercase, it is best to avoid them altogether!
- Semicolon Use:
- A semicolon must seperate statements located on the same line, otherwise it is optional. However, it is considered good practice to end every statement with a semicolon to avoid confusion. This is also good training for those who plan to learn more advanced programming languages (e.g., C++, Java, Perl, Visual Basic, etc.)
- Special Characters:
- Escape Sequences combine a backslash ( \ ) with the character that follows it to either display a character or affect formatting, that is not otherwise representable in the String.
| Sequence | Result |
| \\ | backslash |
| \' | single-quote |
| \" | double-quote |
| \b | backspace |
| \n | newline |
| \r | return |
| \t | tab |
- System Independent:
- Scripting languages are interpreted, not compiled for a particular computer platform nor operating system. They combine tools from full-scale programming languages to make them more concise and usable, even though fewer features means less versatility.
|