- A fragment of code that produces a value is called an expression.
- Binding or variable is how a program store value or remember things.
- The collection of bindings and their values that exist at a given time.
- 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.
- Value. console.log(Math.max(2, 4));
// → 4
Side effect. alert (“hello world”); - The order of execution of a program, which contains more than one statements.
- A program takes the proper branch of execution based on the situation at hand.
- If
- What is an expression?
A fragment of code that produces a value is called an expression - What is a binding?
A binding is basically a variable. After a binding has been defined, its name can be used as an expression. The
value of such an expression is the value the binding currently holds - 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?
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.
- 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.
- 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?
where the program takes the proper branch based on the
situation at hand. - What kind of keyword do you need to use to invoke conditional execution?
if and else.
- a fragment of code that produces a value.
- to catch and hold value.
- the collection of bindings & their values that exist at a given time.
- a piece of program wrapped in value.
- prompt(“enter passcode”);
- a value which can then be used by the enclosing code.
- console.log produces side effects and math produces a value.
- when your program contains more then 1 statement the statements are executed as if they are a story. top to bottom…
- where the program takes the proper branch based on the situation at hand.
- if
- An expression is a fragment of code
- A binding is an attachment of a variable to a value
- An environment is a collection of bindings.
- A function is an expression wrapped in a value. ie: it is a callable code to create a desired output
- let iSum = iValX + iValY
- A side effect is any output that changes the world - even if it is in the minutest way
- let sAnswer = prompt(“What is your Answer?”)
alert("Your answer is: " + sAnswer)
let iSum = iValX + iValY - Control Flow is the direction that the code of the program is read.
- A conditional execution is where the code asks a question or a condition is met that changes which may change the direction of the control flow.
- If, Do, Do While, For
-
An expression is a fragment of code that produces a value.
-
Binding is used to catch and hold values.
-
An environment is a collection of bindings and their values that exist.
-
A function is a piece of program wrapped in a value in which those values can then be applied in order to run the wrapped program.
-
An example of a function is promoting the user for their date of birth.
-
A side effect from a function for example is showing a dialog box or writing text to the screen.
-
A function that produces a side effect is a prompt that asks “What is your age?” A function that produces a value is console.log(2*4).
-
Control flow relates to when your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
-
A conditional execution is created with the if keyword and if a certain condition is true, then a different operation may occur from an input by a user.
-
Use the keyword if to invoke conditional execution.
- What is an expression?
- A fragment of code that produces a value is an expression.
- What is a binding?
- Binding is how Javascript allows things 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.
- Give an example of a function.
- Console.log is a function.
- What is a side effect?
- The result of executing a program.
- Give an example of a function that produces a side effect and another function that produces a value.
- Console.log and alert.
- 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. This is control flow.
- What is conditional execution?
- Conditional execution is when a program takes the proper branch based on a situation at hand.
- What kind of keyword do you need to use to invoke conditional execution?
- While.
- An expression is a fragment of code that produces a value.
- A binding is a function or keyword to catch and hold value.
- An environment is a collection of bindings and their values that exist at a given time.
- A function is a piece of a program wrapped in a value.
- console.log(x)
- A side effect is a function’s influence on the world, for example, a function that shows a text on the screen.
- Alert(“Hello World”), function Let (a = 2, b = 3){return a+b};
- Control Flow is the process in which a program is executed, like a story from Top to Bottom.
- Conditional execution is a type of function, that allows a program to take proper steps based on the situation at hand.
- An ‘If’ function
1.What is an expression?
A piece of code that resolves to value.
2.What is a binding?
It’s a way a program keeps internal state. It stores value for later use.
3.What is an environment?
It’s a set of variables and their values.
4.What is a function?
It performs a specific task.
5.Give an example of a function.
alert(“Welcome to Lampacenter”);
6.What is a side effect?
It occurs if statement or function modifies a state of something else.
7.Give an example of a function that produces a side effect and another function that produces a value.
alert(“alert is a function that produces a side effect”)
console.log(3+7); = value.
8.What is control flow?
From top down execution.
9.What is conditional execution?
A point when program decides what to do in certain conditions.
10.What kind of keyword do you need to use to invoke conditional execution?
“If”
1- An expression is any piece of code that resolves to a value
2- A binding(variable) is a named piece of computer memory, containing some information inside
3- An environment is a set of variables and their values that exist in memory at a given time
4- A function is named section of a program that performs a specific task
5- prompt(“what is your age?”)
6-If a statement or function modifies the state of something else, then it is producing a side effect.
7-
var age = prompt(“What is your age?”);
if (age > 18) true;
else false;
8-Is the order in which individual statements, instructions, or function calls of an imperative program are executed or evaluated.
9-In the simple case, we want some code to be executed if, and only if, a certain condition
holds.
10- if and else
- What is an expression? — fragment of code that produces a value. Like 1; or !false;
- What is a binding? — binds a value to a variable, like let a = 5; var and const can also be used instead of let
- What is an environment? — the collection of bindings and their values that exist in a given time.
- What is a function? — piece of a program wrapped in a value
- Give an example of a function. — prompt(“Enter x: “);
- What is a side effect? — where expression changes something in the world such as changes internal state of machine that effects following statements, or displays something on a screen, like sum=+; or console.log(sum);
- Give an example of a function that produces a side effect and another function that produces a value. — function to produce side effect could be changing a variable value setValue(num); or displaying something to console, function to produce value is a function that takes two inputs and returns some resultant calculated output.
- What is control flow? — sequence in which program statements are executed
- What is conditional execution? — using if statements, these control the control flow of the program based on conditions
- What kind of keyword do you need to use to invoke conditional execution? If else
-
An expression is a fragment of code that produces a value. Every value is an expression, and every expression can contain other expressions.
-
Bindings are variables that hold values.
-
An environment is a collection of bindings and their values.
-
A function is part of a program wrapped in a value.
-
An example of a function is:
prompt(“Enter passcode”); -
A side effect is text produced from a function.
-
An example of a function that produces a side effect is:
console.log(Math.max(2, 4));
// → 4
An example of a function that produces a value is:
console.log(Math.min(2, 4) + 100);
// → 102 -
Control flow refers to the direction of commands from left to right, or top to bottom, when the programming contains more than one statement.
-
Conditional execution refers to how the flow of commands can branch off in response to different results for different statements.
-
To invoke conditional execution, the keyword is if.
- What is an expression?
- Expression is a fragment of code that produces value
- What is a binding?
- Binding is a function that takes a value and holds it in memory
- What is an environment?
- Environment is a collection of bindings and values that exists in memory
- What is a function?
- Function is a piece of program wrapped in a value to execute specific task
- Give an example of a function.
- prompt("How you doin ? ");
- What is a side effect?
- Side effect is - side effect of some functions that we use,
- Give an example of a function that produces a side effect and another function that produces a value.
- Side effect - prompt(“enter username”); -> gives a dialog box
- Value - console.log(2+4);
- What is control flow?
- Control flow - Program that contains various statements which are executed from top to bottom
- What is conditional execution?
- Conditional execution is an execution that get executed only if predetermined conditions are followed
- What kind of keyword do you need to use to invoke conditional execution?
- If --> we want the code to be executed only IF conditions are met
-
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, as is a binary operator applied to two expressions or a unary operator applied to one. -
To catch and hold values, JavaScript provides a thing called a binding, or variable:
let caught = 5 * 5;
That’s a second kind of statement. 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 previous statement creates a binding called caught and uses it to grab hold of the number that is produced by multiplying 5 by 5. After a binding has been defined, its name can be used as an expression. The value of such an expression is the value the binding currently holds.
When a binding points at a value, that does not mean it is tied to that value forever. The = operator can be used at any time on existing bindings to disconnect them from their current value and have them point to a new one. The words var(variable) and const(constant) can also be used to create bindings, in a way similar to let. -
The collection of bindings and their values that exist at a given time is called the environment.
When a program starts up, this environment is not empty. It always contains bindings that are part of the language standard, and most of the time, it also has bindings that provide ways to interact with the surrounding system. -
A function is a piece of program wrapped in a value.
-
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 JavaScript statement is an aggregation of expressions.
A program is a list of statements. A statement stands on its own, and it could display something on the screen or it could change the state of the internal state of the machine in a way that will affect the statements that come after it. These changes are called side effects. -
side effect : propmt(“Enter your name”)
value : var b = 4 -
When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom. Control flow is the order in which statements are executed.
-
In addition to control flow’s “straight line” structure, we might need to create a “branching road” where the program takes the proper branch based on the situation at hand. This is called conditional execution.
-
Contitional execution is created with the if keyword. The if keyword executes or skips a statement depending on the value of a Boolean expression. The deciding expression is written after the keyword, between parentheses, followed by the statement to execute.
You can use the else keyword, together with if, to create two separate, alternative execution paths.
If you have more than two paths to choose from, you can “chain” multiple if,else pairs together.
(if, else, else if)
- What is an expression?
An expression is a fragment of code that produces a value. - What is a binding?
Binding creates a new function that will call the original function but with some of the arguments already fixed. - What is an environment?
An environment is a collection of variables and their values that exist 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() - What is a side effect?
A side effect is produced by a function changing something. This could include displaying something on the screen or changing the internal state of the machine in order to effect the statements that come after it. - Give an example of a function that produces a side effect and another function that produces a value.
A function that produces a side effect is the alert() function.
A function that produces a value is Math.max - What is control flow?
Control flow is the order in which statements are performed within a program - What is conditional execution?
Conditional Execution is where we choose between two different routes based on a boolean value. - What kind of keyword do you need to use to invoke conditional execution?
The keyword “if” is used to invoke a conditional execution.
- What is an expression?
A fragment of code that reproces a value
- What is a binding?
variable
- What is an environment?
Collection of bindings and values that exist at a given time
- What is a function?
- Give an example of a function.
function testMe() {
return true;
}
- What is a side effect?
A side effect is any application state change that is observable outside the called function other than its return value.
- Give an example of a function that produces a side effect and another function that produces a value.
console.log()
- What is control flow?
Direction of code execution
- What is conditional execution?
Execution using conditial flow. For example if/else, while, switch
- What kind of keyword do you need to use to invoke conditional execution?
if, else if, switch, while, for
Expression is a piece of code that produces some kind of value.
Binding or variable holds values.
Environment is a collection of bindings and their values at given moment.
Function is a piece of program that is wrapped in a value. A lot of the values provided in the default environment have the type function.
Example of functions: prompt, console.log.
A side effect is showing a dialog box or writing text to the screen.
Function that produces a side effect is : Math.max
Function that produces a value: Math.min
When program contains more than one statement, the statements are executed from top to the bottom. This is control flow.
Conditional execution is when we want to create a branching road, where the program takes the proper branch based on situation at hand.
The keyword “if” invokes a conditional execution.
- An expression is a piece of code that produces a value.
- A binding is the action of the computer holding value to a certain variable.
- The environment is the collection of bindings and their values that exist at any given point.
- A function is a piece of program that is wrapped in a value.
- alert(“smoke catnip every day”);
- A side effect is the outcome of a statement or function modifying something else.
- prompt() produces a side effect
console.log((math.max)(2, 4)); produces a value - Control flow means that the program will execute its instructions from top to bottom.
- Conditional execution is when the program takes the proper route given the given information.
- if, or other conditional expression
- An expression is a part of coding that produces a value.
- A binding is a way for javascript to hold or remember a value for later use.
- The environment is where the binding and values are kept in memory.
- A function is a piece of expressive programming for a value/s.
- An example of a function is prompt.
- A side effect is where a program has something happen after deployment that noticeably changes something. Versus the program being erased right after it is used, with no changes other than maybe a value being produced.
- A function that produces a side effect is prompt. A function that produces a value is MATH.max.
- Control flow is where the programming being executed goes from first to last in the coding. When options become available for different paths, in the programming, the flow of programming can go one or more ways depending on the input of the user.
- Conditional execution is like a choose-your-own adventure book. Where the user chooses which way the program will take them according to what choices were made.
10.The keyword “if” is used. And when another path is needed “else” is used afterwards.
-
What is an expression?
An expression is a piece of code that produces a value. -
What is a binding?
Binding is the way that javascript catches and holds values to remember things and uses old values to produce new ones. -
What is an environment?
The environment is a collection of all bindings and values that exist in a code. -
What is a function?
A function is a piece of a program that is wrapped in a value. -
Give an example of a function>
You can use the keyword ‘function’ to create function codes, an example of this is:function ShowMessage ()
-
What is a side effect?
Side effects are changes to the world resulting from a statement.
An example of a simple side effect is having a dialog box show up on the screen. -
Give an example of a function that produces a side effect and another function that produces a value.›››
An example of a function that produces a side effect is ‘prompt’ is a function that creates a dialog box asking the user for the desired input.
An example of a function that produces a value is ‘Math.max’ is a function that takes number arguments and returns the greatest number as a value.
-
What is control flow?
The order of which statements are executed from top to bottom. -
What is conditional execution?
Conditional execution is another way for programs to flow, which allows for the program to take a number of branched paths based on the situation. This is accomplished by using the ‘if’ keyword. -
What kind of keyword do you need to use to invoke conditional execution?
To create and invoke conditional execution codes in your program you will use the keyword ‘if’
-
What is an expression?
It’s a fragment of code that produces a value. Ex: 22 or “psycholoanlysis.” -
What is a binding?
Binding allows Javascript to catch and hold values. Example, let caught=5*5.
Imagine bindings like tentacles, rather than boxes. They don’t contain values, they grasp them. Variables and Contants can be used to create Bindings.
Bindings can include a ‘$’ or an ‘_’ (underscore)
let is the keyword for bindings
-
What is an environment?
It’s the collection of bindings and their values that exist at a given time. -
What is a function?
It is a piece of program wrapped in a value. The values can be applied in order to run the wrapped program. -
Give an example of a function.
A box asking for a passcode -
What is a side effect?
It’s the result of a function or statement which will effect another function or statement. -
Give an example of a function that produces a side effect and another function that produces a value.
It’s a dialog box or writing text to the screen -
What is control flow?
When the program contains more than one statement, the statements are executed from top to bottom. -
What is conditional execution?
It’s a branching road where the program takes the proper branch based on the situation at hand. -
What kind of keyword do you need to use to invoke conditional execution?
The keyword is if