-
An expression is a fragment of code that produces a value.
-
Binding allows a program to set and reference a value or string to a variable.
-
The collection of bindings and their values at a given time is called an environment.
-
A function is a type of expression that is a piece of program wrapped in a value.
-
alert(“insufficient funds”);
-
A side effect is an observable change on the application’s screen caused by an expression or function.
-
A function that produces a side effect is: prompt(“Enter DoB”);
A function that produces a value is: console.log(8*8); -
Control flow is the execution workflow when there is more than one statement. It prioritizes from top to bottom.
-
Conditional execution is what a program decides to do when certain conditions are met.
-
Keyword: “if”
- A fragment of code that produces a value is an expression.
- To catch and hold values.
- 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.
- prompt(“Enter Username”);
- Showing a dialog box or writing text to the screen is a side effect.
- Prompt or log are examples of functions which result in side effect but Math.Max and Math.min produce value.
- When your program contains more than one statement, the statements are
executed as if they are a story, from top to bottom. - 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. - If
- What is an expression?
An expression is a piece of code that returns a value the value can be a number, string or boolean, these values can be by themselves or added to variables.
- What is a binding?
A binding s where a value has been placed with a var or let for example
var number = 5;
shows that “number” is now bound and will return the value 5 when console logged or called in a function.
- What is an environment?
An environment is a collection of bindings and their values that exist at any given point in time.
- What is a function?
is a method or group of code to bring a resolution to a problem that utilises input data and results in output data.
- Give an example of a function.
function addTwoNumber(){
var a = 10;
var b = 20;
var result = a+b;
return result;
}
- What is a side effect?
A side effect is anything that can create an observable change within the web page or application.
- Give an example of a function that produces a side effect and another function that produces a value.
function sideEffect(){
alert(“Hello World”);
}
above produces a side effect as this will show the alert in the web browser/viewer
function createValue(){
return (5+6)
}
- What is control flow?
is the order in which the code is executed for example within HTML this is from top to bottom.
- What is conditional execution?
a conditional execution is when a result is dependent on an outcome for example if I wanted a function to carry out an action when a specific number is reached I can write the following:
var number = 5;
function condExecute(){
if(number === 10 ){
alert(true);
}
else{
alert(fulse);
})
}
alert would be false.
- What kind of keyword do you need to use to invoke conditional execution?
if, else, or, and
-
What is an expression? A fragment of code that produces a value.
-
What is a binding? A binding catches and holds a value
-
What is an environment? The collection of bindings and their values that exits at a given time.
-
What is a function? A function is a piece of program wrapped in a value.
-
Give an example of a function? prompt (“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. A) prompt("enter passcode) value example
B) console.log(Math.min(2,4)+100)
// 102 -
What is control flow? a program that contains more than one statement, the statement are executed a if they are a story, from top to bottom
-
What is conditional execution? a program that takes the proper branch based on the situation at hand.
-
What kind of keyword do you need to use to invoke conditional execution? if(keyword)
1 Code producing value
2 Binding is a thing often connected with name and can be given a value by an operator and an expression
3 Collection of bindings and their values
4 Piece of program
5 Boolean( 10 > 9 ) ……. console.log(Math.max(2,4));
6 Non observable statement
7 1;
! true:
Let tiu=10;
Console.log(tiu*tiu);
// - 100
8 Statements are executed like in book reading top to bottom = control flow
9 Go that way if and only if certain condition are fulfilled
10 if
-
expression is a fragment of code that produces a value
-
a binding assigns a value to a variable
-
An environment is 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”);
-
a side effect is the indirect result that is generated because of the function
-
Example of a function that producer a side effect
Var x = 10;
Var y = a+1;
Side effect is in var y where there is an addition was done -
Control flow is the order of which statements are executed from top to bottom
-
Conditional execution is where the program takes the proper branch based on the
situation at hand. -
Conditional execution done by IF
- An expression is a fragment of code that produces a value.
- Bindings are how programs keep an internal state, imagine tentacles pointing to values.
- An environment is where your program is run from, a set of variables and their values that exist in memory at a given time.
- A function is a piece of program wrapped in a value.
- console.log is an example of a function.
- A side effect is the produce of a function, an observable change in the state of an application.
- prompt(“Hi there”) is an example of a function that produces a side effect and console.log(3+6); is an example of a function that produces a value. The difference being that side effects produce observable actions whereas values produce a result displayed by the function.
- Control Flow is the format to how programs are read ,from top to bottom.
- Conditional execution is when part of the program is executed only if certain conditions are met, a program takes the proper branch based on the situation at hand.
- The
if
\else
keyword pair.
- An expression is a fragment of code that produces a value.
- A binding catches and holds values.
- 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.
- console.log is an example of a function.
- A side effect is an observable change on the application’s screen by an expression or function.
- A function that produces a side effect is console.log(“hello”). Another function that produces a value is Math.min(2, 5).
- Control flow is a straight line of executions the statements from top to bottom.
- Conditional execution is a code execution that occurs when the program takes the proper branch based on the situation at hand.
- If, else, else if
-
What is an expression? An expression is a fragment of code that produces a value. It is any value written literally whether it be a number (33) or word in parentheses (“lawn mower”.) It is content to just produce a value, which can then be used by the program.
-
What is a binding? Binding is used to keep values in memory. It is synonymous with variable.
-
What is an environment? An environment is a collection of bindings at any given time.
-
What is a function? A specific relationship between values.
-
Give an example of a function. An example of a function is:
Let x= 45
consol.log (x-5);
40 -
What is a side effect? A function that performs input or output operations or changes global output variables.
-
Give an example of a function that produces a side effect and another function that produces a
value.
Function that produces a side effect (non- deterministic)
math.randomFunction that produces a value: Var somenumber = (x) => x;
-
What is control flow? Control Flow is simply the order in which the statements are executed from the top one first and flow down to the following statement(s).
-
What is conditional execution? Conditional execution is a statement that will use the “if” statement to possibly take a branch off the program based on the situation.
-
What kind of keyword do you need to use to invoke conditional execution?
You will use the “if” statement for conditional execution.
-
A fragment of code that produces a value is an expression.
-
Also called a variable, a binding holds and catches values.
-
The collection of bindings and their values that exist at a given time is called the environment. Even when a program starts up, the environment is not empty. It has and needs a language or operating standard to allow for interaction/development/execution.
-
A function is a piece of program wrapped in a value. Such values can be applied in order to run the wrapped program.
-
For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input. It is used like this: prompt(“Enter passcode”);
-
A statement that could display something on the screen—that counts as changing the world—or it could change is called a side effect. The internal state of the machine in a way that will affect the statements that come after it. These changes are called side effects.
-
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.
For example, the function Math.max takes any amount of number
arguments and gives back the greatest.
console.log(Math.max(2, 4));
// → 4
- Control Flow is logical, top to bottom, read like a story, order of operations. Straight-line operation. ----------->.
let theNumber = Number(prompt(“Pick a number”));
console.log("Your number is the square root of " +
theNumber * theNumber);
For example: The function Number converts a value to a number. We need that conversion because the result of prompt is a string value, and we want a number. There are similar functions called String and Boolean that convert values to those types.
-
What is conditional execution?
When we need to create a branching road, where the program takes the proper branch based on the situation at hand. It is an action where the outcome response depends on the input before it, and will then react with an outcome accordingly. -
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?
A binding is for catching and holding different values. it also goes under the name variable. -
What is an environment?
The enviroment is the collection of bindings and theur values at a given time. -
What is a function?
A function isa piece of program wrapped in a value. -
Give an example of a function.
alert(“i like arguments”); -
What is a side effect?
If a statement or function modifies the state of something else (outside its own scope), then it is
producing a side effect. -
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); -
What is control flow?
it’s the order the in which the computer executes the statements in a script. they are executed as if it was a story. from top to bottom. -
What is conditional execution?
A conditional execution is when the computer need to decide its way depending on the situation.
think about if your building a trading algo. when to sell and when to buy for example. -
What kind of keyword do you need to use to invoke conditional execution?
IF
- Expression is a fragment of code that results in a value.
- Binding is when you bind certain value to a variable.
- Environment is set of bindings and their values that already exists in a program.
- Function is a predetermined piece of program wrapped in a value.
- Math.min( 2, 4)
- Side effects is a piece of code that has an impression on the world, or in other words it is not thrown away immediately after its use.
Function that produces a side effect:
prompt(“insert a number”)
Function that produces a value:
console.log(Math.max(2,4));
-
Control flow is an explanation on how (which order) the code is being executed.
-
Condition execution is determined by keyword if in the JavaScript. It means that if first condition is not met, execute the second. It can also have more criteria, depending on the code.
-
To invoke conditional execution you need to use keyword if.
- Expression is a fragment of code that produces a value. The simplest kind of statement can be an expression with a semicolon after it. Ex: 1;
- Bindings are like tentacles - they do not hold any information but grasp them. Bindings assign internal state to catch and hold values.
- The Environment is the collection of bindings and their values that exist at a given time.
- A function is a piece of program wrapped in a value and perform specific task. Such values can be applied in order to run the wrapped program.
- Ex. of functions: console.log, math.min, math.max
- Side effect is a dialogue box or writing text to the screen
prompt(“Enter password”) - produces a side effect which prompts dialogue box
console.log(math.max(3,5)) - has no side effect, but produces value of: 5
-
Control flow is the order, in which the statement or function calls are executed
-
Conditional execution evaluates whether there are certain conditions in order to execute (or do not execute) a given part of the code.
-
IF is the keyword to invoke or call execution
- What is an expression?
A fragment of code that produces a value
- What is a binding?
Second type of statement that catches and holds a value
- 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 in a value
- Give an example of a function.
The bind ‘prompt (“enter passcode”)’
- 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.
Math.max
Math.min
- What is control flow?
A statement executed as if it was a story, from top to bottom
- What is conditional execution?
A branched road in which the program takes based on the situation at hand
- 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.
-
Binding aka variable in JS is an expression to catch and hold value.
-
The collection of bindings and their values that exist at a given point is called the environment.
-
A function is a piece of program wrapped in a value.
-
A statement on its own amount to something only if it affects(change) the world. These changes are called side effects.
-
Function that produces side effect: alert(“hello world”);
Function that produces value: console.log(2+4);
-
Control flow is when the program contains more than one statement, the statements are executed as if they are a story from top to bottom.
-
Not all program are straight roads. we may want to create a branching road where the program takes the proper branch based on the situation at hand. this is called conditional execution.
-
if
1.A fragment of code that produces a value.
-
A variable, to catch and hold values.
-
A collection of bindings and their values that exist at a given time.
-
A piece of program wrapped in a value that can be applied in order to run the wrapped program.
-
The
console.log
function, to output values and/or arguments. -
A by-product of a function.
-
Showing a dialog box or writing text to the screen is a side effect and the function
Math.max
takes any amount of number arguments and returns the greatest. -
The execution of more than one statement in a program, like a story, from top to bottom.
-
Execution created through the use of ‘if’ and ‘else’ keywords. Used when some code is to be executed if, and only if, a certain condition holds. If not, ‘else’ comes into play.
- A fragment of code that produces a value
- Can be described as tentacles the point to values
- A collection of Bindings the values they point to at a specific time
- A piece of program wrapped in a value, the value can be applied to run the function
- prompt, console.log,
- If an expression changes the internal state of the machine so that the statements that come after are changed
- Alert function produces popup. Math.max produces the highest value
- Defines in which order the statements in a program are executed, which is from top to bottom
- executed by the if keyword and means a certain code will be executed only if a certain condition is true
- if
-
What is an expression?
An expression is content that produces a value and it is enclosed in a code. -
What is a binding?
Binding or variable is used to catch and hold values. -
What is an environment?
It is the collections of bindings and their values in the background of a program, for example a browser. -
What is a function?
A function is a piece of program wrapped in a value. The values are applied to run the wrapped program. -
Give an example of a function.
prompt(“Enter Passcode”); is a dialog box asking user for input. -
What is a side effect?
It can refer to interaction with the outside world from a function. -
Give an example of a function that produces a side effect and another function that produces a value.
var theNumber = Number(prompt(“Pick a number!”));
Console.log("Your number is the square root of " + theNumber * theNumber); -
What is control flow?
When a program contains many statements they are executed from top to bottom like in a story. -
What is conditional execution?
Not all programs can be executed in a straight line. Sometimes execution should follow only if certain conditions are true. -
What kind of keyword do you need to use to invoke conditional execution?
If… else & Switch.
-
What is an expression?
= An expression is the question or the task you want javascript to evaluate. It is the fragments of the code. -
What is a binding?
= A way to “grab” a value. creating a binding creates a “link” or a tentacle from the binding to the value. -
What is an environment?
= The collection of bindings and their values. -
What is a function?
= A piece of program wrapped in a value. Invoking, Calling or Applying it with its binding will execute it. -
Give an example of a function.
= let Name = ‘Rikke’;
function showMessage() {
let message = 'Hello, ’ + userName;
alert(message);
}
showMessage(); // Hello, Rikke
-
What is a side effect?
= A statement that effects the statements that comes after it. -
Give an example of a function that produces a side effect and another function that produces a value.
Side effect:
alert (“Hello World”);
No side effect:
math.min (4, 6, 8,);
-
What is control flow?
= When you have more than 1 statement they are executed in the order they where written. -
What is conditional execution?
When you create certain conditions before an outcome. So the code is only executed if a certain condition is upheld, is not is is skipped. Often there are several conditional executions so there is a condition for each input. -
What kind of keyword do you need to use to invoke conditional execution?
if, else, else if.
-
A fragment of code that produces a value is called an expression.
-
A pointer that is tied to value and can be disconnected and point to a new one.
-
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.
-
like username or password dialog box
-
Showing a dialog box or writing text to the screen is a side effect.
var a = 25
console.log(math.max(3, 5)+ a));
// -> 30
-
When your program contains more than one statement, the statements are
executed as if they are a story, from top to bottom. -
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. -
if, else