instead: console.log(a || b); // if a is true, return a, otherwise return b console.log(a && b); // if a is false, return a, otherwise return b Programmers who are more familiar with the behavior in C might find this feature surprising, but it allows for a more concise expression of patterns like null coalescing: var s = t || "(default)"; // assigns t, or the default value, if t is null, empty, etc. Logical assignment Bitwise JavaScript supports the following binary bitwise operators: Examples: x=11 & 6; console.log(x); // 2 JavaScript supports the following unary bitwise operator: Bitwise Assignment JavaScript supports the following binary assignment operators: Examples: x=7; console.log(x); // 7 x<<=3; console.log(x); // 7->14->28->56 String Examples: str = "ab" + "cd"; // "abcd" str += "e"; // "abcde" str2 = "2" + 2; // "22", not "4" or 4. ?? Control structures Compound statements A pair of curly brackets { } and an enclosed sequence of statements constitute a compound statement, which can be used wherever a statement can be used. If ... else if (expr) { //statements; } else if (expr2) { //statements; } else { //statements; } Conditional (ternary) operator The conditional operator creates an expression that evaluates as one of two expressions depending on a condition. This is similar to the if statement that selects one of two statements to execute depending on a condition. I.e., the conditional operator is to expressions what if is to statements. result = condition ? expression : alternative; is the same as: if (condition) { result = expression; } else { result = alternative; } Unlike the if statement, the conditional operator cannot omit its "else-branch". Switch statement The syntax of the JavaScript switch statement is as follows: switch (expr) { case SOMEVALUE: // statements; break; case ANOTHERVALUE: // statements for when ANOTHERVALUE || ORNAOTHERONE // no break statement, falling through to the following case case ORANOTHERONE: // statements specific to ORANOTHERONE (i.e. !ANOTHERVALUE && ORANOTHER); break; //The buck stops here. case YETANOTHER: // statements; break; default: // statements; break; } break; is optional; however, it is usually needed, since otherwise code execution will continue to the body of the next case block. This fall through behavior can be used when the same set of statements apply in several cases, effectively creating a disjunction between those cases. Add a break statement to the end of the last case as