- What is an expression?
A fragment of code that produces a value is called an expression. Every value that is written literally (such as 22 or “psychoanalysis”) is an expression. An expression between parentheses is also an expression. Expressions can contain other expressions in a way similar to how sub sentences in human languages are nested—a sub sentence can contain its own sub sentences, and so on. This allows us to build expressions that describe arbitrarily complex computations.
- What is a binding?
The first,var(short for “variable”), is the way bindings were declared in pre-2015 JavaScript. The word const stands for constant. It defines a constant binding, which points at the same value for as long as it lives. This is useful for bindings that give a name to a value so that you can easily refer to it later. The word const stands for constant. It defines a constant binding, which points at the same value for as long as it lives. This is useful for bindings that give a name to a value so that you can easily refer to it later.
- 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 in order to run the wrapped program.
- Give an example of a function.
In a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input.
- What is a side effect?
A lot of functions are useful because of the side effects they produce. Functions may also produce values, in which case they don’t need to have a side effect to be useful.
- Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Enter passcode”); gets you a function a little dialog box
- 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?
Conditional Execution Is when we want some code to be executed if, and only if, a certain condition holds. We might, for example, want to show the square of the input only if the input is actually a number. the program takes the proper action based on the situation at hand.
- What kind of keyword do you need to use to invoke conditional execution?
Conditional execution is created with the if keyword in JavaScript. You can use the else keyword, together with if, to create two separate, alternative execution paths.