What is an expression?
A fragment of code that produces a value is called an expression.
Expression is a piece of code that resolves to a value/becomes a value.
A statement is an instruction, an action. Expression is not an instruction or action, it’s only an expression, a value.
What is a binding?
The binding memorizes a number or a value.
That’s how the program keeps an internal state and remembers things.
To catch and hold values, we use bindings.
What is an environment?
The collection of bindings and their values that exist at a given time is called the environment.
What is a function?
A function is a block of code designed to perform a task.
Give an example of a function.
alert(“Hello!”);
console.log(firstname);
What is a side effect?
Showing a dialog box or writing text to the screen is a side effect.
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Enter password”); → side effect
console.log(Math.max(1, 3 ,5)); → value effect
What is control flow?
The order in which the program/computer executes statements in a script. The statements are executed from top to bottom, as if they are a fairy tale.
What is conditional execution?
Conditional executions are used to perform different actions based on different conditions.
What kind of keyword do you need to use to invoke conditional execution?
The if statement.