a precautionary measure, in case additional cases are added later. String literal values can also be used for the case values. Expressions can be used instead of values. The default case (optional) is executed when the expression does not match any other specified cases. Braces are required. For loop The syntax of the JavaScript for loop is as follows: for (initial; condition; loop statement) { /* statements will be executed every time the for{} loop cycles, while the condition is satisfied */ } or for (initial; condition; loop statement(iteration)) // one statement For ... in loop The syntax of the JavaScript for ... in loop is as follows: for (var property_name in some_object) { // statements using some_object[property_name]; } Iterates through all enumerable properties of an object. Iterates through all used indices of array including all user-defined properties of array object, if any. Thus it may be better to use a traditional for loop with a numeric index when iterating over arrays. There are differences between the various Web browsers with regard to which properties will be reflected with the for...in loop statement. In theory, this is controlled by an internal state property defined by the ECMAscript standard called "DontEnum", but in practice, each browser returns a slightly different set of properties during introspection. It is useful to test for a given property using }. Thus, adding a method to the array prototype with } may cause for ... in loops to loop over the method's name. While loop The syntax of the JavaScript while loop is as follows: while (condition) { statement1; statement2; statement3; ... } Do ... while loop The syntax of the JavaScript do ... while loop is as follows: do { statement1; statement2; statement3; ... } while (condition); With The with statement adds all of the given object's properties and methods into the following block's scope, letting them be referenced as if they were local variables. with (document) { var a = getElementById('a'); var b = getElementById('b'); var c = getElementById('c'); }; Note the absence of before each invocation. The semantics are similar to the with statement of Pascal. Because the availability of with statements hinders program performance and is believed to reduce code clarity (since any given variable could actually be a property from an enclosing ), this statement is not allowed in strict mode. Labels JavaScript supports nested labels in most implementations. Loops or