reading-notes

Functions

A function in JavaScript is similar to a procedure a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output.

Defining functions

For example

function square(number) { return number * number; }

Control flow

The control flow is the order in which the computer executes. Code is run in order from the first line in the file to the last line

A typical script in JavaScript or PHP (and the like) includes many control structures, including conditionals, loops and functions. Parts of a script may also be set to execute when events occur.

JavaScript Operators

* let x = 5; // assign the value 5 to x * let y = 2; // assign the value 2 to y
* let z = x + y; // assign the value 7 to z (5 + 2)