for
loops: evaluate a preset amount of times before breakingwhile
loops: evaluate an infinetely amount of times++
and --
in JS)const one = foo [0]
, const two = foo[1]
, with destructing: const [one, two] = foo
)this
refers to current object;()
Parentheses creates a grouped expression; new
create an instance of a user-defined object type; super
call functions on an object’s parentfor
statement:for ([initialExpression];[conditionExpression];[incrementExpression]) statement
for ... in
statement ()for (variable in object) statement
note: for an Array, it is better to use for
instead of for...in
, since the name of user-defined properties in additional to the numeric indexes will be returned
do...while
statement: repeats until a specified condition evaluates to false
do, is the condition is false, statement within the loop stops executing statement //always executed ONCE before the condition is checked, use
{}
to group the statements while (condition); //further executes if returned true
while
: condition test occurs before statementwhile (condition) statement
break
statement: terminate a loop. Can be used with a label (terminates the specified labeled statement) or without labels (terminates the innermost enclosing while, do-while, for, or switch)
continue
statement: restart a loop (can be used with or without label)