Statements and expressions
JavaScript distinguishes expressions and statements.
An expression produces a value
and can be written wherever a value is expected, for example as an argument in a function call.
A statement performs an action.
Loops and if statements are examples of statements. A program is basically a sequence of statements Wherever JavaScript expects a statement, you can also write an expression. Such a statement is called an expression statement. The reverse does not hold: you cannot write a statement where JavaScript expects an expression. For example, an if statement cannot become the argument of a function.
JavaScript Regular Expressions
A regular expression is a sequence of characters that forms a search pattern. The search pattern can be used for text search and text replace operations A regular expression can be a single character, or a more complicated pattern. Regular expressions can be used to perform all types of text search and text replace operations. var patt = /htmllocation/i; /htmllocation/i is a regular expression. htmllocation is a pattern (to be used in a search). i is a modifier (modifies the search to be case-insensitive).
Expressions and operators
Arithmetic operators + - * / % ++ -- % Assignment operators = += -= /= Comparison operators = = (Equal) != (Not Equal) < > >= <= Bitwise operators & (Bitwise AND) | (BitWise OR) ^ (Bitwise XOR) ~ (Bitwise Not) << (Left Shift) >> (Right Shift) >>> (Right shift with Zero) Logical operators && (Logical AND) || (Logical OR) ! (Logical NOT String operators Conditional (ternary) operator ? : If Condition is true? Then value X : Otherwise value Y Comma operator Unary operators Relational operator typeof Operator
up