What is an expression?
A fragment of code that produces a value is called an expression
What is a binding?
To catch and hold values. Aka 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?
A function is a piece of program wrapped in a value
Give an example of a function.
Math.pow(2,3)
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.
function testf (){
age=prompt (âplease provide your ageâ)
return "my age is: "+age;
}
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?
The order by which the program execute statements depends in some conditions.
What kind of keyword do you need to use to invoke conditional execution?
if, else if, else
- Code that resolves a value
- Code stored in memory
- A collection of bindings and their values
- An expression wrapped in a value
- alert("this message is being read:)
- Observable change in state of the application
- alert(âalert function will produce a side efectâ) console.log(1+1); will produce a value
- The flow of execution form top to bottom
- A point where the program decides what to do based of certain conditions
- âifâ
1. What is an expression? A fragment of code that produces a value.
2. What is a binding? Its to catch and hold values.
3. What is an environment? The collections of binding and their values that exist on a given time.
4. What is a function? Itâs a piece of program wrapped in a value. Such values can be implied in order to run the wrapped program.
5. Give an example of a function. Var, prompt, if
6. What is a side effect? Showing a dialog box or writing text to the screen
7. Give an example of a function that produces a side effect and another function that produces a value. Prompt and Sum.
8. What is control flow? Its way to describe the flow of the statements from top to bottom.
9. What is conditional execution? Itâs a way to command that a piece a program only executes if, and only if, the condition holds.
What kind of keyword do you need to use to invoke conditional execution? If.
- A fragment of code that produces a value is called an expression.
2.In programming it is methode of catching and holding values. bindings are tentacles, rather than boxes.
3,The collection of bindings and their values that exist at a given time is called
the environment
4,A function is a piece of program wrapped in a value. Such values can be applied
in order to run the wrapped program. - prompt function, consol.log
- when executed fuction change the world
7.side effect - comsole.log, values - Math.max
8,when program go straight.
9.Situation where the program takes the proper branch based on the
situation at hand, diffrent than control flow. - If
What is an expression? - its everything that ends with an ;
What is a binding? binding is the association of the name of the variable to a memory registry
What is an environment? is the colletction of the binding and its values
What is a function? a function its a block of code wrapped in {}
Give an example of a function.
function example(num1, num2)
{
return num1>num2;
}
What is a side effect? its the result that a function gives, like prompt;
Give an example of a function that produces a side effect and another function that produces a value - .alert(âthis produces a side effectâ); Math.max(2,4); this produces a value
What is control flow? its when you have multiple statements and the program is read from top to bottom
What is conditional execution? its when you have a condition that can make you change to other function for example,
What kind of keyword do you need to use to invoke conditional execution? if else
What is an expression?
An expression is any statement that return a value. We can have expressions nested in other expressions .
What is a binding?
Binding is give a value a name so we can keep it for use later.
What is an environment?
Environment is all the values that are binding in our program.
What is a function?
A function is a block of code or a block of statements wrapped so we can reuse it anytime we need it just calling it.
Give an example of a function.
function print(doc) {
console.log(doc);
}
What is a side effect?
Side effect is for example when we call a function and this function change something else other than the return value of the function
Give an example of a function that produces a side effect and another function that produces a value.
side effect
let x = 0;
function count() {
x = 10; // change the var value to the var outside of the function
while (count<100) {
console.log(count);
}
}
An a function that produces a value:
function sum(a ,b) {
return a + b;
}
What is control flow?
Control flow is the way the program follow the orders in a program.
What is conditional execution?
A conditional execution is when the flow of the program has to check certain condition before continue and depend of the condition is the path that is going to execute.
What kind of keyword do you need to use to invoke conditional execution?
if , else
- An expression returns a value
- Binding is when you allow a variable to be a value
- Environment is the the collection of bindings at a point in time
- A function is a group of code that can be accessed by the program to compute a value
- function add (a, b) { return a + b; }
- Side effects happen when a statement changes the environment
and affects the statements that come after it. - let theNumber = Number(prompt(âPick a numberâ));
if (!Number.isNaN(theNumber)) {
console.log("Your number is the square root of " +
theNumber * theNumber);
} - Conditional execution is like a fork in the road. The program uses if, else, if else to evaluate a condition and continue executing the branch of code based on the value returned from that condition.
- if, else, if else
1. What is an expression?
An expression is a fragment of code that produces a value. Expressions can contain other expressions.
2. What is a binding?
A binding allows you to catch and hold values in JavaScript by invoking a reference name linked to the memory address where it is stored. Bindings are preceded by keywords âletâ, âvarâ or âconstâ.
3. What is an environment?
An environment is the collection of bindings and their values that exist at a given time.
4. What is a function?
A function is a piece of program wrapped in a value. These values can be applied in order to run the wrapped program.
5. Give an example of a function.
prompt("Enter passcode")
6. What is a side effect?
Showing a dialog box or writing text to the screen is a
side effect
7. Give an example of a function that produces a side effect and another function that produces a value.
side effect: console.log()
, value: Math.max()
8. 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.
9. What is conditional execution?
Conditional execution is a branching path where the program chooses which branch to take based on a boolean condition.
10. What kind of keyword do you need to use to invoke conditional execution?
The âifâ keyword
- An expression is a piece of code that produces a value.
- A binding is a way that a value is bound to memory, it allows the program to use values until they are no longer needed and their binding is either removed or dissipates.
- Environment is the place where your code sits and runs, generally holds your values and bindings.
- A function is something that takes in none or more arguments (values) and spits out another value. Generally its a program wrapped in a value.
- consol.log(âPaulâ) is a function
- Side effect is the result of a function
- A function that produces a side effect would be alert(âboom!â), a function that produces a value would be console.log(Math.min(2, 6) + 100)
- In coding in general code flow generally refers to the use of statements to enable flow through the program and attain the desired result or process that you want your program to carry out.
- An if statement is an example of conditional execution and allows the code to branch off given a âconditionâ before it resumes normal flow with the result of the conditional statement.
- An 'if keyword allows conditional statements
What is an expression?
An expression is a fragment of code that produces a value.
What is a binding?
A Binding is a defined variable use to store values
What is an environment?
The environment is a collection of bindings
What is a function?
A function is a block of reusable code that can be called at any time during a program.
Give an example of a function.
function showprompt(message) {
console.log(message);
}
What is a side effect?
A side effect if the âeffectâ the function has on the program, i.e. showing a prompt / dialog box
Give an example of a function that produces a side effect and another function that produces a value.
Math.max(3,4);
What is control flow?
A program that contains more than one statement wich are executed in âstory formâ, from top to bottom
What is conditional execution?
A conditional execution is a part of code whos execution is dependant on certain conditions.
What kind of keyword do you need to use to invoke conditional execution?
if, else
- A fragment of code that produces a value.
- Naming an expression.
- The collection of bindings and their values that exist at a given time.
- A function is a piece of program wrapped in a value.
- alert(âhello worldâ);
- Showing a dialog box or writing text to the screen is a side effect.
- Produces side effect prompt(âEnter passcodeâ); Produces value console.log(Math.max(2, 4));
- When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
- If we desire to make the program act different accordingly situation, we create a branching road, where the program takes the proper branch based on the situation at hand.
- If, else
Binding, Function an Flow Control
- An expression is a piece of code that produces a result.
- A binding is a variable.
- The environment is a collection of bindings that exist at the current time.
- a functions is a group of bindings or a another function that can be called from another part of the codebase.
- Function example : Alert("Test");
- outputting something to the screen or a dialogue box is a side effect.
- Side effect --> prompt("Enter Passcode"); Value -->console.log(23 == 82)
- Flow control is the way in which you change the flow of execution instead of just top to bottom.
- its is a "If, Then , else" statement if a certain binding is true then do something else do something.
- if (condition) {do stuff if true} else {do stuff if false}
-
What is an expression?
expressions is any code, that produces a value -
What is a binding?
a point to a value -
What is an environment?
the collection of bindings and there values at a given time -
What is a function?
a piece of program wrapped in a value -
Give an example of a function.
function coolfunc(arg1) {
return arg1 + 2;
}
coolfunc(2);
// 4 -
What is a side effect?
when statements are changing something else (displaying something on screen or modifying statements after), this is called a side effect -
Give an example of a function that produces a side effect and another function that produces a value.
alert(âHey champsâ);
function coolfunc(arg1) {
return arg1 + 2;
}
coolfunc(2);
// 4
-
What is control flow?
the order in which statements are executed -
What is conditional execution?
a part of the code is only executed if a defined condition is met. -
What kind of keyword do you need to use to invoke conditional execution?
if
What is an expression?
An expression is a piece of code that reduces down to a value.
What is a binding?
a binding ties a value to a name. it allows a value to be stored for later use
What is an environment?
An environment contains all of your programs bindings and statments
What is a function?
A function is a reusable piece of code that is defined once and used throughout the program to perform a task.
Give an example of a function.
console.log()
What is a side effect?
It is how the function effects the world.
Give an example of a function that produces a side effect and another function that produces a value.
consol.log() produces a side effect of writing to the screen. Math.max() gives the maximum value of the arguments provided.
What is control flow?
it describes the flow of the programs execution. The program can go forward, loop, or fork.
What is conditional execution?
Conditional execution allows the code to run only if the condition is met. Otherwise, it will be skipped.
What kind of keyword do you need to use to invoke conditional execution?
if
-
An expression is a fragment of code that produces a value. 2 + 2 = 4, the whole line itself, is an expression.
-
A binding is when a value is tied to another term. let a = 3, in this case the three is bound to a and any reference to a from that point forward would be synonymous with the number three.
-
An environment is the collection of bindings at any given time in a program.
-
A function is a small program that produces a value.
-
function addNum(a, b) {
return a+b;}
addNum(2, 2);
4 -
A side effect is when a function changes the state of the page or its internal state in some way. A function that creates a dialog box would be an example. As compared to the above function that only returns a value.
-
The above function produces a value. For a side effect:
function alertName(name) {
alert("Hey " + name);}
alertName(âIvanâ);
Alert box pops up with âHey Ivanâ -
Control flow is the order in which a function operates. It goes from top to bottom. Based on that, the first part of a function can alter the second part.
-
A conditional execution gives a result based on if a condition is met or not met. If you enter a name equal to or longer than eight characters â alert: thatâs a long name. Else, thatâs not a very long name.
-
If is the word used to invoke conditional execution.
What is an expression?
A fragment of code that produces a value. Every value that is written literally is an expression.
What is a binding?
To catch and hold values JS uses a binding or variable using a keyword to define it.
What is an environment?
Environment is the collection of bindings and their values that exists at a given time.
What is a function? Give an example of a function.
Function is a piece of a program wrapped in a value. An example is a dialog box asking for user input in the browser.
What is a side effect?
A statement that causes an observable change (either external or internal) in a way that will affect the statements that come after it. A function that produces a side effect would be one that shows a dialog box or writes text to the screen.
Give an example of a function that produces a side effect and another function that produces a value.
prompt(âEnter passcodeâ);
console.log(Math.max(2,4));
// 4
What is control flow?
Control flow occurs when a program contains more than one statement and the statements are executed from top to bottom.
What is conditional execution? What kind of keyword do you need to use to invoke conditional execution?
Conditional execution is used when code is executed based on if the condition is true or false. Keywords used are âifâ or âelseâ.
1. What is an Expression?
A fragment of code that produces a value.
2. What is a Binding?
When a value is linked to a variable.
3. What is an Environment?
A collection of bindings and their values that exist at any given time.
4. What is a Function?
A piece of a program wrapped in a value.
5. Give an example of a function.
alert(âHello Worldâ);
6. What is a Side Effect?
Any application state that is observable outside the called function other than its return value.
Example:
Showing an alert or a prompt.
7. Give an example of a function that produces (a) a side effect & (b) a value.
a) console.log();
b) math.max();
8. What is Control Flow?
This ensures statements are executed in the proper order.
9. What is Conditional Execution?
Code that will only execute if a certain condition is met.
10. What kind of keyword do you need to invoke Conditional Execution?
IF/ELSE statement
- A fragment of code that produces a value
- Used to catch and hold a value. Also called a variable or constant.
- Collection of bindings and their values at a given time.
- Piece of program wrapped in a value. These values can be applied in order to run the wrapped program.
- prompt (âenter the passwordâ);
- Something that affects the world, either it displays something on the screen or it changes statements that come after it.
- prompt ("enter the password); math.max(1,2);
- When a program has more than one statement, the way the statements are executed from top to bottom.
- It gives the code an alternative so 2 different roads can be taken.
- if
1. What is an expression?
An expression is a fragment of code that produces a value.
2. What is a binding?
A binding catches and holds values.
3. What is an environment?
An environment is the collection of bindings and their values, which exist at a given time.
4. What is a function?
A function is a piece of program wrapped in a value.
5. Give an example of a function.
prompt(âEnter nameâ);
6. What is a side effect?
A side effect is a statement that could change the machineâs internal state, and thus will affect the following statements.
7. Give an example of a function that produces a side effect and another function that produces a value.
Side effect function:
prompt(âEnter nameâ);
Value function:
console.log(Math.min(2, 4));
8. What is control flow?
Control flow is the order in which the computer executes statements in a program.
9. What is conditional execution?
Conditional execution is where the program takes the proper branch, based on the
situation.
10. What kind of keyword do you need to use to invoke conditional execution?
You need to use the if keyword to invoke conditional execution.
- A fragment of code that produces a value.
- Basically a variable.
- A collection of bindings and their values that exist at a give time.
- A function is a piece of program wrapped in a value.
- alert(âICOâ); is a function.
- 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 (e.g., a global variable, or a variable in the parent function scope chain).
- let num = 0;
const func = () => {
num = 1;
return true;
}
func(); - The order in which the computer executes statements in a script.
- Not all programs are just straight roads. When we create branches to the roads it is called conditional execution.
- For example IF