Program Structure
What is an expression?
An expression is a fragment of code that produces a value.
What is a binding?
A binding is a variable, it holds the value of an expression.
What is an environment?
The environment is a collection of bindings and their names at a given time.
What is a function?
A function is a piece of program wrapped in value where such value can be applied in order to run the program.
Give an example of a function.
alert(“bitcoin to the moon”);
What is a side effect?
A side effect is any application state change that is observable outside the called function other than its return value. Side effects include:
Modifying any external variable or object property
Logging to the console
Writing to the screen
Writing to a file
Writing to the network
Triggering any external process
Calling any other functions with side-effects
Give an example of a function that produces a side effect and another function that produces a value.
Side effect
alert(“when moon Ivan”);
Value
console.log(Math.max(3, 6));
What is control flow?
A control flow is the order in which the computer executes statements in a script.
What is conditional execution?
Statements are executed depending on a condition.
What kind of keyword do you need to use to invoke conditional execution?
if
else