This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
notes:javascript_cheat_sheet [2026/11/02 04:33] 47.79.201.252 old revision restored (2026/09/08 14:17) |
notes:javascript_cheat_sheet [2026/11/03 05:24] (current) 87.201.184.186 old revision restored (2026/09/15 01:55) |
||
|---|---|---|---|
| Line 22: | Line 22: | ||
| * In an external file called from either the head or the body e.g. <script src=" | * In an external file called from either the head or the body e.g. <script src=" | ||
| - | ==== Javascript | + | ==== Basic Syntax ==== |
| * JavaScript is case-sensitive. | * JavaScript is case-sensitive. | ||
| Line 28: | Line 28: | ||
| * Blocks may be grouped together using curly braces { }. | * Blocks may be grouped together using curly braces { }. | ||
| * JavaScript uses java-style comments: // and /* */. | * JavaScript uses java-style comments: // and /* */. | ||
| + | * JavaScript variables are case-sensitive and must begin with a letter or underscore. | ||
| + | * Variables are automatically declared when first used but should be explicitly declared using e.g. var a = 5; | ||
| + | * JavaScript uses standard C/Java operators e.g. +-*/%, ++, +=, &&, ||, !, + (concatenation). | ||
| + | * JavaScript uses C/Java comparators >,> | ||
| + | |||
| + | ==== Basic Structures ==== | ||
| + | |||
| + | * if {} else if {} else {} | ||
| + | * switch (n) { case 1: stmt; break; default: stmt; } | ||
| + | * for (var=start; | ||
| + | * while (condition) {} | ||
| + | * do {} while (condition) ; | ||
| + | * //break// and // | ||
| * | * | ||