reading notes for code fellows
the control flow is the order in which the computer executes statements in a script. Code runs in order from the first line to the last unless it hits something like a loop or a function call that changes the structure.
a function is a block of code designed to do a specific task, and it is executed when something invokes it.
function NAME(parameters){ code here } is the way to write a function.
return is the command to stop executing the function, and the code listed after return will become the return value, which is given back to the ‘caller’.
you can define the code once and use it in many different spots with different results.
the name of a function followed by parenthesis will return the result, while using no parenthesis will return the function object.
functions can be used in the same manner of variables in all the same situations.
variables declared within a function can only be accessed from within that function. Because of this, the same variable name can be used in multiple functions.
= assigns a value to a variable+ adds numbers or concatenates strings* multiplies numbers- subtracts numbers** exponentiates/ divides numbers% gives the division remainder++ increments numbers-- decrements numbers== is equal to=== equal value AND type!= not equal to!== not equal value OR type> greater than< less than>= greater than or equal to<= less than or equal to? ternary operator&& logical and|| logical or! logical nottypeof returns the type of a variableinstanceof returns true if an object is an instance of an object type& AND| OR~ NOT^ XOR<< left shift>> right shift>>> unsigned right shift