-
What is an expression?
A fragment of code that produces a value. -
What is a binding?
A binding is the way Javascript remembers things in the form of a variable. -
What is an environment?
An environment is the collection of bindings and their values that exist at a given time. A web browser has functions that allow it to interact with the frontend of dapps. -
What is a function?
A function is a piece or part of a program that is wrapped in a value. -
Give an example of a function.
console.log(2 + 5);
7
We will be constantly using the console.log function in our web browsers to test ideas quickly and view output values. -
What is a side effect?
A side effect is where a program changes the state of a machine in which the statements that come after will be affected. -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(âSuccessâ); (side effect of dialog box)
console.log(5 +7); (returns a value of 12) -
What is control flow?
Control flow is the direction or order of operations (execution of code statements) from top to bottom in a program. -
What is conditional execution?
Conditional execution is where we program through branches (or code execution options) if and when certain conditions are met in the program. -
What kind of keyword do you need to use to invoke conditional execution?
Some keywords for conditional execution are âifâ, âelse ifâ, and âelse.â
- What is an expression?
- An expression is a fragment of code that produces a value!
- What is a binding?
- A binding is when a programmer creates new value from old value and then wants to catch and hold that value right awaty, they will do it with a binding!
- What is an environment?
- An environment is a collection of bindings and values that exist at any given time!
- What is a function?
- A function is a piece of program wrapped in a value!
- Give an example of a function.
- let luigisDebt = 140;
luigisDebt = luigisDebt - 35;
console.log(luigisDebt);
- What is a side effect?
- A side effect is showing a dialog box or writing text to the screen!
- Give an example of a function that produces a side effect and another function that produces a value.
- console.log(Math.max(2, 4));
// â 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 all programs are straight roads so when a programmer wants to create
a branching road, 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?
- You use the keyword âifâ to invoke conditional execution!
-
What is an expression?
A piece of code that produces a value is called a expression. -
What is a binding?
Binding allow you to store a bit of data for future use. -
What is an environment?
The collection of variables 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. -
Give an example of a function.
alert (âLearning A Lotâ) -
What is a side effect?
A side effect is a results of the order of the function, the last variable will decide the end value. -
Give an example of a function that produces a side effect and another function that produces a value.
Side effect: alert(âBTC 1,000,000â)
Function: console.log(10000*100); produces a value.
-
What is control flow?
The order of executing code from top to bottom left to right. -
What is conditional execution?
conditional execution means that a condition is only executed when it meets predefined condition -
What kind of keyword do you need to use to invoke conditional execution?
If, else
Q: What is an expression?
A: A fragment of code that produces a value. Example:
Q: What is a binding?
A: A binding is something Javascript produces to catch and hold values. Also called a variable.
Q: What is an environment?
A: The collection of bindings and their values that exist at a given time.
Q: What is a function?
A: A function is a piece of program that is wrapped in a value.
Q: Give an example of a function.
A: Prompt(âEnter Passcodeâ)
Q: What is a side effect?
A: Showing a dialog box or writing text to the screen.
Q: Give an example of a function that produces a side effect and another function that produces a value.
A: Side Effect: Prompt(âEnter Passwordâ)
Value: Math.max(2,4);
Q: What is control flow?
A: When your program contains more than one statement, the statements are executed from top to bottom (as if they are a story).
Q: What is conditional execution?
A: Itâs kind of like an if/then statement. A piece of code will be executed if and only if a certain condition holds.
Q: What kind of keyword do you need to use to invoke conditional execution?
A: The âIfâ keyword.
- What is an expression?
An expression is a fragment of code that produces a value. - What is a binding?
Binding is a variable that catches and holds on to values. - What is an environment?
An environment is a collection of bindings and their values that exist at any given time. - What is a function?
A function is a piece of code wrapped in a value. - Give an example of a function.
prompt(âEnter passcodeâ); - What is a side effect?
A side effect is produced by functions, showing a digital box, or writing on the screen. - Give an example of a function that produces a side effect and another function that produces a value.
side affect= ( prompt(âEnter passcodeâ); )
value= ( (console.log(Math.max(2,4); ) - What is a control flow?
It is a representation of the execution of the code. - What is conditional execution?
It is a branching program where if certain conditions are met the program executes one way or another. - What kind of keyword do you need to use to invoke conditional execution?
The ( if ) keyword.
if (!Number.isNaN( theNumber))
-
Expression is a fragment of code that produces a value.
-
Binding is the same as variable. It âholdsâ values in the programm, you can give an expression a name using the keyword âletâ followed by bindings name and followed by operator â=â and to use this variable later in programm as much as you want. Values of the variable is not âstuckâ and can be changed.
-
The environment is a collection of bindings and their values that exist at a given time.
-
A function is a piece of program wrapped in a value
-
prompt(âEnter passcodeâ)
-
Showing a dialog box or writing text to the screen
-
Math.max function produces value
promt(âEnter passcodeâ) produces side effect: dialog box -
Control flow is how your computer runs code from top to bottom. It starts from the first line and ends at the last line, unless it hits any statement that changes the control flow of the program such as loops, conditionals, or functions.
-
Not all programs are straight lines. Conditional execution is created with the keyword âifâ and it decides on which way it will go according to the chosen conditions.
-
Keyword âifâ and âelseâ (but it is not mandatory to use else).
-
A fragment of code that produces a value is called an expression.
-
A binding is a way to catch and hold values this is done thru a binding, or variable. ex. let, var.
-
An environment is a collection of bindings and their values that exist at a given time.
-
A function is a piece of program wrapped in a value.
-
// This function will return the smaller of 2 given numeric inputs.
min = (a, b) => {
if(a < b) return a;
else return b
} -
A side effect is a statement in which changes the internal state of a machine in a way that will affect the statements that come after it.
-
value: console.log(Math.max(2, 4));
side effect: prompt(âEnter Passcodeâ); -
Control flow is the order in which statement are executed. When there is more than 1 statement in a program the statements are executed as a story, from top to bottom. This is known as straight line control flow.
-
Conditional execution is when certain parameters have to be met in order for a statement to be executed. This is done using the âifâ keyword.
-
âifâ keyword allows conditional execution to be made possible.
- an expression can be any written text,(include reserved word) string, number and any piece of code that can produce such value. Values expressed between parentheses(functions, arrays) and values with unary and binary operators(arithmetic operation, Boolean, etc) are expressions.
A function declaration and a function call can be expression too as it returns a value.
2.Special word let, var, const allows a value to be assigned to a name so that this value can be referenced(remembered) for future use. - a JS environment is where Javascript runs. For browsers, it consists of programming interface DOM that interacts with JS engine(interpret and execute codes), Javascript standard(ECMAScript), the browser(interact with webpage via web APIs), and window(display, I/O & hardware).
4&5. âa function is a block of reusable codes that perform a particular taskâ. e.g. isNgN();
6&7.When a function cause change(s)(or affect something )outside the function itself then this function causes side-effect. eg, when a function read or write to a file/http request/console.log(). A function can produce side effect both intentional or unintentional. - Control flow is the order which the computer execute your code. Javascript normally executes its code from top to bottom.
9&10 Conditional execution is deciding the flow of execution based on conditions defined by if and else statement.
4&5. âa function is a block of reusable codes that perform a particular taskâ. e.g. isNgN();
6&7.When a function cause change(s)(or affect something )outside the function itself then this function causes side-effect. eg, when a function read or write to a file/http request/console.log(). A function can produce side effect both intentional or unintentional.
8. Control flow is the order which the computer execute your code. Javascript normally executes its code from top to bottom.
9&10 Conditional execution is deciding the flow of execution based on conditions defined by if and else statement.
-
What is an expression?
A fragment of code that produces a value. -
What is a binding?
A thing that JavaScript provides to catch and hold values. This is also known as a variable. -
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?
Several values provided in the default environment have the type 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.
For example, the binding prompt holds a function in a browser environment
which shows a little dialog box asking for a user input. It is used like this:
prompt(insert a value here such as âJavaScript is impossibleâ); -
What is a side effect?
A change in the internal state of the machine which will affect the statements that come after it. -
Give an example of a function that produces a side effect and another function that produces a value.
Side Effect:
1st line: var f = 1;
2nd line: var g = f++;
Now f returns the side effect value 2 (instead of the original 1).
Producing a Value:
console.log(Math.min(2, 4) + 100);
102 (The function chooses the smallest nr (between 2 & 4) and adds another 100 to produce a total value.
-
What is control flow?
When a program reads written code/lines, it is performed in the order from the top to the bottom. -
What is conditional execution?
With the if-keyword, programs can read coded lines/situations in a non-linear way. In a way you can influence the direction which the program chooses to read from. -
What kind of keyword do you need to use to invoke conditional execution?
if.
- What is an expression?
A fragment of code that produces a value - What is a binding?
Binding is what is in Javascript that catch and holds value. Keeps an internal state and remembers old values so that new values from old ones. - What is an environment?
Collection of bindings and their values that exist at a given time - What is a function?
A piece of program wrapped ina value that can be applied in order to run the wrapped program. - Give an example of a function.
Alert(âNice to meet youâ) - What is a side effect?
Showing a dialog box or writing text to the screen - Give an example of a function that produces a side effect and another function that produces a value.
console.log(Math.min (3,6));
// -> 3 - What is control flow?
Containing more that one statement that are executed from top to bottom like a story. - What is conditional execution?
Where the program takes the proper branch based on situation given - What kind of keyword do you need to use to invoke conditional execution?
if, else
- It is any valid unit of code which evaluates to a value.
- Binding - when a variable is connected to a value.
- It is the collection of variables and their values, existing at a given time.
- Function is a piece of program designated to do a particular task.
- confirm("âŚ");
- Side effect is an observable change once the function is invoked.
- alert(âHey!â); - side effect;
Math.max (6, 58); returns 58 - value - Itâs the order in which the code is executed by the computer.
- Itâs when not all of the code is executed, when there is a requirement to skip parts of it.
- if, else, else if.
Please could you provide answers to these two questions as well? If there are any doubts, please feel free to ask them out here.
Happy Learning!
1.An expression i a fragment of code
2.Binding is a way to catch and hold values, like memorizing something you could say
3.An environment is a collection of binding ad their value that exist
4.A function is a piece of program wrapped in a value
5.Examples of a function; console.log() and alert()
6.Side effects are statements that can affect the next statement, functions have side affects
7.Prompt() produces a side effect, and console.log() produces a value
8.Control flow is when a program contains more then one statement and is read top to bottom
9.Conditional execution is a branching road so that some code can be executed if certain conditions are meet.
10.âifâ and âelseâ invoke conditional execution
-
What is an expression?
Any piece of code that produces a value is an expression -
What is a binding?
This is what JS uses to catch or hold a value -
What is an environment?
This is the result of all the bindings put together. -
What is a function?
Function is a program wrapped in a value -
Give an example of a function.
let num = Number(prompt(âPick a number dudeâ) -
What is a side effect?
Getting text written on the screen or in a pop-up box. -
Give an example of a function that produces a side effect and another function that produces a value.
a: console.log (âHello worldâ)
b: console.log (2 + 2) -
What is control flow?
This is the direction in which the program is executed. Using specific conditions will force the program to jump back and forth or f.eg. in loops until the logic or conditions are completed. -
What is conditional execution?
Thats a part of the program that only is run if certain predefined conditions are met. F.eg if a specific input is given it will result in a particular prompt. -
What kind of keyword do you need to use to invoke conditional execution?
if
- Is a fragment of code that produces a value.
- A binding or variable is a kind of statement that allows a new value to hold without using it immediately. Is represented by the keyword âletâ followed by the name of the binding, an = operator and an expression. Then the name of the binding can be used as an expression which value is the result of the binding expression. The value of the binding can be changed by naming the binding =operator and new expression. And multiples bindings can be defined in a single statement by separating them by commas. There can be also used as bindings the words var (variable) and const (constant). The name of the binding can contain numbers and letters, but it canât start with a number, it also can contain $ and _ but no other punctuation, special character or keywords and reserved words.
- Is the collection of bindings and itâs values that a program needs to work.
- Itâs a program wrapped in a value that can be invoked by the name of the binding. Values given to functions are called arguments.
- The binding login, holding a value, which is a program that shows two dialog boxes were the user needs to input their username and password, is used like this: login(âloginFormâ);
- Is the return value of a function call that can be used later within larger expressions.
- Math.cos(2);, prompt(âHelloâ);
- Control flow is the order in which a program execute its statements.
- Is when a program chooses a branch depending on the result of a boolean expression. This is achieved by the if keyword.
- Keywords if, else, else if, while, do, for, break and continue.
- An expression is a piece of code, similar to a sentence fragment, that can produce a value.
expression = sentence fragment , statement = full sentence
A program is a list of statements - A binding is another kind of statement used to catch and hold values, a variable.
- An environment is a collection of bindings or variables and their values that are held in memory.
- A function is a piece of program wrapped in a value. It is used to carry out certain tasks when called upon.
- alert(âThis alert is a function.â);
- A side effect is a statement that affects a change in what is displayed (world change), or a change that affects the statements that follow.
- alert(âGet ready to learn JavaScript.â)
console.log(2+4) - Control flow is the way statements are executed from top to bottom.
- Conditional execution is when a program executes statements based on the situation.
- You would use the if and else keywords.
- An expression is a bit of code that returns a value.
- A binding (similar to a variable) is a piece of code that is linked to a value with the = operator.
- An environment is a description of all current bindings.
- A function is a piece of program wrapped in a value.
- console.log(Math.max(2, 4));
- When an expression does not return a value.
- Side Effect: alert(âHello world!â); Value:
- The order in which the instructions of a program are executed.
- Conditional execution describes the flow a program is executed when there are multiple ways to execute the code based on a user input.
- if, else
What is an expression?
an expression is a piece of code which produces a value
What is a binding?
a binding is another term for a variable
What is an environment?
An environment is the variable set applicable to a program along with their values at a given time
What is a function?
So the book says âA function is a piece of program wrapped in a valueâ which I find a little confusing; I assume what this means is that a function is a defined expression/sub-routine which is given a specific name and which can be called/executed using that name
Give an example of a function.
console.log â writes a text output of its srgument(s)
What is a side effect?
a side effect is something which happens as a result of a function such as displaying a dialogue box or writing to the screen
Give an example of a function that produces a side effect and another function that produces a value. Math.max returns the maximum value of its arguments
Consol.log side effect of writing the function output to the screen
What is control flow?
this refers to the order in which the code is executed, I.e. from top to bottom in the absence of conditions
What is conditional execution?
this allows a program to execute different expressions depending on on the criteria fulfilled by the inputs
What kind of keyword do you need to use to invoke conditional execution?
If / else if / else
Thanks, itâs finally done. This took me several hours to complete and understandâŚ