- What is an expression?
A fragment of code that produces a value is called an expression, no matter if the value is given literally or combined by operators. Expression can contain other expressions.
- What is a binding?
Bindings hold values for later use. By using the word ‘let’ we create binding by giving it a name and/or expression.
- 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 piece of program wrapped in a value. Such values can be applied/called in order to run the wrapped program.
- Give an example of a function.
prompt(“Enter passcode”); the binding prompt holds a function that shows a little dialog box asking for user input.
- What is a side effect?
When a statement change the internal state of the machine or in a way that will affect the statements that come after it, not just holding a value but displaying it on the screen or saving it into a database. These changes are called side effects.
- Give an example of a function that produces a side effect and another function that produces a value.
Value
x = Math.max(2, 4);
Side effect (the output of the value in console/computer screen)
console.log(Math.max(2, 4));
- What is control flow?
When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
- What is conditional execution?
Not a straight control flow. We may, for example, want to create a branching control flow, where the program takes the proper branch based on the situation at hand. This is called conditional execution.
- What kind of keyword do you need to use to invoke conditional execution?
if