- A fragment of code that produces a value.
- A binding or variable catches and holds values.
- The collection of bindings at any given time.
- Values that exist in the default environment such as a browser.
prompt("Enter passcode");
- Producing a dialogue box or writing text to the screen.
- Side effect:
prompt
andMath.max
- The order that the statements are executed i.e. from top to bottom
- Where the programme chooses the correct branch based on the ‘if’ keyword.
- ‘if’
- A fragment of code that produces a value.
- JavaScript uses binding to catch and hold values.
- The collection of bindings and their values that exist at a given time.
- A piece of program wrapped ina value.
- console.log (2 + 4);
- Something that happens even though it was not intended - ie console.log showing a dialog box.
- console.log (“Hello World”);
console.log (2 + 4); - The direction in which a program is executed ie the program is executed from top to bottom ie control flow is from top to bottom.
- Where you give the computer a choice and depending on the choice, a different branch or control flow is taken.
- If
- A fragment of code that produces a value is an expression
- Javascript uses bindings to catch and hold values, JavaScript
- The collection of bindings and their values that exist at a given time is called
the environment. - A function is a piece of program wrapped in a value. Such values can be applied
in order to run the wrapped program. - prompt (“Enter passcode”);
- Showing a dialog box or writing text to the screen is a side effect.
- Side Effects: prompt(“enter passcode”);
Values: 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. - Programm can execute functions in different ways according to the values entered
- if keyword in JavaScript
-
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. The special word (keyword) let indicates
that this sentence is going to define a binding. It is followed by the name of
the binding and, if we want to immediately give it a value, by an = operator
and an expression.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. Executing a function is called invoking, calling, or applying it. -
Give an example of a function.
prompt(“Enter passcode”); -
What is a side effect?
Return values -> A lot of functions are useful because of the side effects they produce. -
Give an example of a function that produces a side effect and another function that produces a value.
console.log produces side effect
Math.max produces a value -
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 created with the if keyword in JavaScript. In the
simple case, we want some code to be executed if, and only if, a certain condition
holds. -
What kind of keyword do you need to use to invoke conditional execution?
IF
1.Expression is a fragment of code which produces value.
2.Binding is when you set a value to letter for example a = 1, you bind “a” to be equal to 1.
3.Environment is a collection of bindings and theirs values that exist at a given time.
4.Function is a piece of program wrapped in a value.
5.prompt(Enter how much money you want to receive)
6.Side effect is showing a dialog box or writing a text to the screen.
7. prompt(Enter username:) - side effect, console.log (Math.max (2,3,4)); gives value.
8.Control flow - if you have multiple statement it execute it in sequence from top to bottom.
9.Conditional execution is created with “if” keyword when we want it to get executed only when some kind of conditions applies.
10. “if” or you can use “else”
1. What is an expression?
A fragment of code that produces a value
2. What is a binding?
Holding/remembering the value of an assigned keyword
3. What is an environment?
The collection of bindings and their values that exist at a given time
4. What is a function?
A piece of program wrapped in a value. Functions are executed when they are called to do something, in which they perform a particular task. Functions take inputs, do something with it, and give outputs.
5. Give an example of a function.
function patricksFunction(x,y) {
return x * y;
}
patricksFunction(7, 7)
< 49
6. What is a side effect?
Any change that affects the world
7. Give an example of a function that produces a side effect and another function that produces a value.
Side effect
alert(“I am a side effect of programming!”);
Value
a=false
< false
b=true
< true
a||b
< true
8. What is control flow?
That statements are executed in order; first to last.
9. What is conditional execution?
To have something only execute if specific conditions are met
10. What kind of keyword do you need to use to invoke conditional execution?
if && else
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, JavaScript provides a thing called a binding…”
It can also be called a variable.
What is an environment?
“The collection of bindings and their values that exist at a given time is called the environment.”
In otherwords, the current set of variables that are defined in memory.
What is a function?
“A function is a piece of program wrapped in a value.”
Basically, it is a program assigned to a variable, for recall at a later time.
Give an example of a function.
The reading used the example: “prompt(“Enter passcode”);” Where “Enter passcode” is the function held by the binding “prompt”
What is a side effect?
A side effect is any output (even printing to the screen) other than the direct result of the program.
Give an example of a function that produces a side effect and another function that produces a value.
“Showing a dialog box or writing text to the screen is a side effect.”
What is control flow?
Control flow references arguments that are used to determine how the program will behave and which of 2 or more predefined code paths will be executed next.
What is conditional execution?
Conditional execution is when a condition must be met for the code to continue. Example
from the reading: if (!Number.isNaN(theNumber))
This code is used to check if the supplied input is a number, if it is, the code will continue to run. (it actually says, “If it is the opposite of (!), not a number (NaN)”)
What kind of keyword do you need to use to invoke conditional execution?
if
What is an expression?
A fragment of code or complete code that produces a value.
What is a link?
Binding / Variable is created to catch and hold values.
What is an environment?
The collection of bindings and their values that exists at a given time.
What is a function?
Is a block of code designed to perform a particular task.
Give an example of a function.
Function (a, b) {
X = a + b * 5;
return X
}
What is a side effect?
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.
Side effect
Promt (“Enter your wallet address”)
Function
Console.log (Math.max (3,5));
What is the flow of control?
A control flow is when excecuting a program is runs from top to bottom.
What is conditional execution?
an if / then that controls if something happens or not.
What type of keyword do you need to use to invoke conditional execution?
Conditional execution is created with the if keyword in JavaScript.
1.Expression is a fragment of code that produces a value
2.Binding (aka variable) allows a program to remember values and allow these to be changed
3.The program’s environment is the collection of bindings and their values at a given time
4.A function is a piece of program or a procedure wrapped in a value and is designed to perform a specific task. It’s similar to a subroutine in other programming languages
5.example of a function Math.max(10,3)
6. a side effect is an observable effect/change caused by the function other than its return value
7. Prompt(“enter passcode”) produces a box on the screen to enter your passcode, which is a side effect. Math.min(10,3) will just return the minimum value (i.e. 3) as required by the fundtion.
sorry didn’t finish
8. control flow just reads the statements in a program from top to bottom. There is no conditional execution or looping to disturb the flow
9. Conditional execution is simply thought of as “if X happens, then do Y, else do Z”
10 Conditional execution is invoked by the keyword “if”.
What is an expression?
-Part of the code which produces a value. For example “5+5” is an expression.
What is a binding?
-With binding you can catch and hold values. keyword for binding is “let”. I mostly does the samething as var.
What is an environment?
-Collection of bindings and their values that exist at a given time.
What is a function?
-A piece of program that is given a particular task.
Give an example of a function.
- f(x) = 10;
What is a side effect?
-Showing a dialog box or writing text to the screen is aside effect. for example alert(“produces a side effect”);
console.log(5+5) produces value
What is control flow?
statement are executed from top to bottom.
What is conditional execution?
-If the condition is true it wil execute. Otherwise program continues to the next statement.
What kind of keyword do you need to use to invoke conditional execution?
-if
-
What is an expression?
it is a piece of the code -
What is a binding?
when you give a name to a value -
What is an environment?
all the bindings of values the program uses -
What is a function?
a string of code that produces a side effect or value -
Give an example of a function.
promt(“do u wanna dance”) -
What is a side effect?
the pop up window or other element that is produced after a function executes -
Give an example of a function that produces a side effect and another function that produces a value.
let money = Number(prompt(“how much money u got?”));
alert("you owe me $100 now you only got " + (money - 100));
the windows that pop up are side effects and the final number you get is the value
-
What is control flow?
it is the order expressions get executed -
What is conditional execution?
an execution the occurs only under special circumstances -
What kind of keyword do you need to use to invoke conditional execution?
if, else
- piece of code which creates value
- assing a value to an expressin
- an environment contains a set of bindings and their values in a given time
- a function is a set of coding which contains bindings.
- promt() is a funcition
- a sinde effect is for example a dialog which does not belong to the main task of the function
- Prompt does both. it opens a dialog and return the value
- control folw is the order in which the code is executed
- the coding will be only executed if a condition is true or false
- if (condition) { execute this;} else { do this;}
-
A value of code that produces a value.
-
A Binding is a variable and is to catch and hold values.
-
The Environment is a collection of Bindings and their values that exist at a given time is called the environment.
-
A Function is a piece of program wrapped in a value.
-
prompt (“Enter Password”) is an example of a Function.
-
Showing a dialog box or writing text to the screen is a side effect.
-
prompt(“Enter password”); is a Function with a side effect because it shows a box along with the value. And console.log(Math.max(2, 4) is an example of of return value.
-
Control Flow is when your program contains more than one statements, or executed as if they are a story, from top to bottom.
-
Conditional execution is when we want to create more than one road for the program to take which is based on the current situation at the time.
-
The IF keyword
1
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
2
a connection that holds and “remembers” a value
3
The collection of bindings and their values that exist at a given time is called the environment.
4/5
A function is a piece of program wrapped in a value. it performs a task. for example here to prompt sth;
ex. prompt(“Enter passcode”);
6
A side effect is a function which produces an expression and returns that value.
7
alert (“function that prices side effect”)
console.log(1+1); produces an output.
8
When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
9
execute a command only if something else is given.
simple example
if (number + number == even.number) console.log (“True”);
input 1+5 output: True.
Textbook example
let theNumber = Number(prompt(“Pick a number”)); if (!Number.isNaN(theNumber))
{console.log("Your number is the square root of " + theNumber * theNumber);}
10
if
-
What is an expression?
An expression is a fragment of code that produces a value. -
What is a binding?
In Javascript, we use the binding feature to catch and hold values. It allows a program to keep an internal state. -
What is an environment?
Environment is the collection of bindings and their values that exist at a certain time. -
What is a function?
A function is a piece of program wrapped in a value (which can be applied in order to run the wrapped program). -
Give an example of a function.
prompt(“Enter passcode”);
This function shows a little dialog box for user imput. -
What is a side effect?
A side effect is produced by the functions, like 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.
The function prompt(“Enter passcode”); produces a side effect.
The function Math.max(5, 10); produces a value. -
What is control flow?
When there’s more than one statement in the program, those statements are executed from top to bottom, straight-line control flow. -
What is conditional execution?
Conditional execution happens when the program can choose whether to execute one or another statement, depending on the value of a Boolean expression. -
What kind of keyword do you need to use to invoke conditional execution?
Conditional execution can be invoked using the “if” Javascript keyword.
- What is an expression? A fragment of code that produces a value is called an expression.
- What is a binding? Binding is to catch and hold values
- 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. For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input. Such as “enter passcode”
- 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. When a function produces a value, it is said to return that value. For example, the function Math.max takes any amount of number arguments and gives back the greatest. A function which produces a side effect is a dialog box, and the ability to write to the screen.
- What is control flow? A control flow is 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. We may, for example, want 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? Conditional execution is created with the keyword “if” in JavaScript.
- A fragment of code that produces a value.
- A piece of code that catches and holds a value.
- The collection of bindings and their values that exist at a given time.
- A piece of program wrapped in a value. The value can be ‘applied’ in order to run the wrapped program.
- console.log (“hello world”);
- Changes produced by a statement (eg displaying something on screen, or changing the internal state of the program).
- alert (“hi”);
console.log (Math.max(2, 5)); - When a program contains more than one statement, the process in which the program is read (from top to bottom).
- When a program branches, and takes a particular branch depending on the situation at hand.
- if
Answers By Horacio
1.A fragment of code that produces a value is called expression.
2.Is a program that catch and hold values is called: binding, or variable.
3.The collection of bindings and their values that exist at a given time is called the enviroment.
- Is a piece of program wrapped in a value.
5.Prompt (“enter passcode”);
- Is when a statement stands on its own so it a amount to something only if affect the world or it could change the internal state of the machine in a way that will affect the statement that came after it. ( This changes are called side effects).
7.Console.log (Math.max(2,4));
// 4
-
When you program contains more that one statement, the statement are executed as if they are a story.
-
Not all programs are straight roads. When a program takes the program base on the situation on hand. If else, else if.
- An expression is a fragment of code that produces a value.
- Binding is a sort of tentacle that catches and holds a value.
- The collection of bindings and their values that exist at a given time.
- A set of statements that performs a task or calculates a value.
- let test = double(3);
- That is any change in the system which is observable to outside world.
- Showing a dialog box or writing text to the screen is a side effect. A function that produces a value; console.log(Math.max(2, 4));
- The execution of the statements, from top to bottom.
- The execution will only be done when the input fits…
- if.