-
An expression is a piece of code that produces a value.
-
Binding is the term used when referring to catching and holding a variable.
-
The environment refers to the state of all bindings and values at a given point in time.
-
A function is a segment of code wrapped in a value.
-
An example of a function is prompt()
-
A side effect is a change of state that is visible outside of the function ie. text on screen.
-
A function that produces a side effect is prompt()
-
Control flow is the order in which code is written and executed.
-
If/else statements execute a block of code if a defined condition is true/false. They are said to be âconditional statementsâ because they perform different functions in different environments.
-
Keywords to invoke conditional execution are if/else.
-
What is an expression?
a fragment of code that produces a value. -
What is a binding?
This is a way for Javascript to catch and hold values -
What is an environment?
It is the collection of bindings and their values that exists in a particular point in time. -
What is a function?
It is a piece of program wrapped in a value. -
Give an example of a function.
console.log(âtextâ); -
What is a side effect?
Showing a dialog box or writing text to screen is a side effect. -
Give an example of a function that produces a side effect and another function that produces a value.
Side effect: console.log(âtextâ);
value: 4+4 -
What is control flow?
The order in which your statements are executed. -
What is conditional execution?
It is when we want a piece of code executed only if some condition is met. -
What kind of keyword do you need to use to invoke conditional execution?
If
1. What is an expression?
An expression is a fragment of code that produces a value
2. What is a binding?
A binding is a piece of coding that allows a developer to catch and hold values. Bindings are also called variables
3. What is an environment?
The collection of bindings are their values is called the environment
4. What is a function?
A function is of program wrapped in a value.
5. Give an example of a function
An example of a function frequently used is console.log. The console.log feature allows you to insert information to the console
6. What is a side effect?
Showing a dialog box or writing text to the screen is a side effect. A lot of functions are useful because of the side effects they produce
7. 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 value is Math.max. This function will return the greatest number. An example of a function with a side effect is the prompt function this shows a little dialog box asking for a user input
8. What is control flow?
When a program contains more than one statement, the statements are executed from top to bottom.
9. What is conditional execution?
Conditional Execution is where there might be more than one routes to take. It matters from. the situation what code is going to be executed.
10. What kind of keyword do you need to use to invoke conditional execution?
A great example of conditional execution would be the keywords if or else.
Answers:
- A fragment of code that produces a value
- An element used to catch and hold values (a variable)
- The collection of bindings and their values that exist at a given time
- A function is a piece of program wrapped in a value
- Prompt
- Things like showing a dialog box or writing text to the screen.
- alert (âThis is an alert on a windowâ) and console.log(30+8)
- In a program statements are executed as if they are a story, from top to bottom. This is called control flow.
- When using a logical operator to determine if certain parts of the code will be executed
- âIfâ
An expression is fragment of code that produces a value
An elemento to catch and hold values, it is a space reserved in memory.
The 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â);
Side effects are changes that change the internal state of a machine or that make display something on the screen.
A function that produces a side effect:
let x = 30;
console.log(âthe value of x isâ, x);
// â the value of x is 30
A function that produce a value:
console.log(Math.max(2, 4));
It is the way the program flows, if we have more than one statement, the program will execute it from top to bottom.
It is when you have more than one road to take, it happens when you have several statements to execute depending on which condition you are fulfilling.
To invoke them you have to use IF and ELSE.
- What is an expression? anything (fragment of code) that produces a value
- What is a binding? to catch and hold values
- What is an environment? collection of bindings
- What is a function? programmed wrapped in a value
- Give an example of a function. console.log(âhelloworldâ);
- What is a side effect? showing text to a screen
- Give an example of a function that produces a side effect and another function that produces a value. alart(âhelloworldâ);
- What is control flow? top down execution of statments
- What is conditional execution? outcome/direction of program is dependent scenario
- What kind of keyword do you need to use to invoke conditional execution? if else
- An expression is any type of value, variable, or any type of code that can output or return a value
- Binding is attaching a variable to a a value and by that allowing the code to add it to memory.
- An environment is the collection of all binding and values that related to the program as soon as itâs start running and used to interact with our webpage or other program.
- a function is a wrapped piece of code that perform get an input(s) and print out-puts, or perform any type of task in order to execute more functions.
- Give an example of a function.
function reduceTax(INCOME){
INCOMEAFTAX = (INCOME / 100) * 75;
return INCOMEAFTAX;
}
- a side effect can occur due to a function, a function out put sometimes can perform a change in the user environment or a webpage appearance. those are some of the example that functions can do other then get or calculate values.
- A function that produce a side effect:
function bloodyHell(){
document.body.style.backgroundColor = "red";
}
A function that produce a value (same as Q 5):
function reduceTax(INCOME){
INCOMEAFTAX = (INCOME / 100) * 75;
return INCOMEAFTAX;
}
- Control flow an order of actions or series of statements that will be executed in a flow or order.
- Conditional execution is when our code been given more then one boolean options to execute, and they will be asked in a control flow.
- âIfâ or âelseâ
example:
if (statement1 = true){
return "A"
}
else {
return "B"
}
-
An expression is a piece of code that expresses a value. An expression produces a value that can then be introduced into the code.
-
Binding is the attachment of two values which are then produced from the variable.
ex: John = 30 + 5;
this would bind (John) to (35). -
The environment is a collection of bindings and their values that exist at a given time. For example, programs have environments that are not empty. They have bindings that are part of the language standard. and have bindings to interact with the keyboard / mouse / sound / etc.
-
A function is a piece of program wrapped in a value. These values can be applied to run the wrapped program. On a browser a prompt would pop up asking for a password or pin code. prompt(âEnter Passwordâ); However, in modern programming these prompts are not used because there is no control over the way the dialog box pops up.
-
prompt(âEnter your ageâ);
-
A side effect is the output of the function. For example the side effect of prompt(âEnter ageâ); would be the actual dialog box that pops up.
-
Side effect: prompt(âWhat is your favorite color?â);
Value: console.log(Math.min(100 , 200) + 300);
// 400 -
Control as is it sounds⊠a flow⊠or ⊠a story. it will produce somewhat of a story. In playing with this I came up with the following:
theNumber=Number(prompt(âPick a numberâ));
(Enters â45â in prompt)
console.log("Your number is 200% of " +theNumber / 2);
Result = Your number is 200% of 22.5
The Number function will take a value and turn it into a number. Number(promptâŠetcâŠ) does this.
-
A conditional execution would be used when a branching road is desired.
theNumber=Number(prompt(âPick a numberâ)); if (!Number.isNaN(theNumber)) {console.log("Your number is the square root of " + theNumber * theNumber);}
When this is entered a number must be entered into the text box. Otherwise it will not work because theNumber represents a value executing the program changes it into a ânumberâ to show the desired result of what value (number) that YOUR number is the square root of. If letters are entered into the box it will not compute. -
We use the keyword if
if there is not a number entered so that the program can change it from a value to a number then it will not compute so no output will be ejected.
- An expression is a syntactic entity in a programming language that may be evaluated to determine its value
- Binding is assigning one thing to another, usually, values to variables either by explicit declaration or implicit declaration
- An Environment is everything installed on your machine which can affect either the development and or testing of your application
- A Function is a set of statements, which is used to perform a specific task or calculate a value
- let sayHello = function (âname â) {
console.log(âHello Userâ);
} - Side Effect is result of a function that is not its main purpose
- Value: Math.max() Side Effect: Console.log(â â)
- The Control Flow is the order in which the computer executes statements in a script
- A program is executed depending on the current situation
- âifâ
- An expression is a fragment of code that produces a value
- A binding points to/grabs a value
- The environment is the collection of bindings and their values that exist at a given time
- A function is a piece of program wrapped inside a value
- An example of a function: the binding âalertâ holds a function of creating a pop-up box on a website
- Side effects are the visual byproduct of functions, such as a dialog box or text
a) function that produces side effect: alert(âhelloâ);
b) function that produces a value: 1+1;
8. Control flow is the direction of execution of the program
9. Conditional Execution is where the Control Flow can take a number of different routes depending on the situation at hand/instructions given.
10. The keyword needed to invoke Conditional Execution is âifâ
What is an expression?
Any fragment of code that produces a value
What is a binding?
Also known as a variable and is a way to capture and store a value for future use
What is an environment?
Set of bindings and corresponding 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.
ï»żconsole.log()
ï»ż
What is a side effect?
ï»żA ny application state change that is observable outside the called function other than its return value. The function interacts with the outside world.
ï»ż
Give an example of a function that produces a side effect and another function that produces a value.
ï»żconsole.log(âPrint Me!â); has a side effect and ï»żconsole.log(Math.max(2, 4)); is an example of a function that produces a value with no side effect
ï»ż
What is control flow?
ï»żï»żThe order in which the computer executes statements in a script
What is conditional execution?
ï»żSpecific code is executed if certain conditions are met
ï»ż
What kind of keyword do you need to use to invoke conditional execution?
ï»żInvoke conditional execution in javascript using the âifâ keyword
- Every value that was produced by fragment of code even if it is written literally or between parentheses is an expression.
- Binding is a method with which a program catch and hold values. Binding do not contain values it grasp them and hold them in order to use them later.
- The collection of bindings and their values that a program has( at a given time ), that are part of the language standard and provide ways to interact with the surrounding system Is called environment
- A function is a piece of program wrapped in a value that is applied to run the wrapped program.
- An example of a function is âpromptâ function which (we usually use it in toy programs and experiments) uses the string that we give it as a text to show in the dialog box, asking for user input : prompt(âEnter passcodeâ);
Also console.log is a function that writes out argument to the console. - Side effect is a dialog box or writing text that is showing to the screen, that a faction produce.
7)a) side effect : prompt(âEnter emailâ);
b) value: console.log(Math.max(8, 11))
//â> 11
8) control flow is the order (from top to bottom) in which statements of program are executed when they are two or more
9) Conditional execution is when we want the program to execute a code not straight ,but from a branching road that we create( under certain conditions).
10) the â if keywordâ create Conditional execution but also we can use the âelseâ keyword, together with if to create two separate, execution paths
-
What is an expression?
A fragment of code that produces a value. -
What is a binding?
A binding is a variable, and maybe likened to a tentacle, in that it grasps and holds values, rather than boxes, which contain values. Bindings may be defined by the keywords âlet,â âvar,â or âconst.â âVarâ was primarily used pre-2015, before âletâ was introduced. âConstâ is used to define constants. -
What is an environment?
An environment is the collection of bindings and their values that exist at a given time. -
What is a function?
A function is a piece of program wrapped in a value, which is then applied in order to run to the wrapped program. -
Give an example of a function.
The prompt() function in the browser environment is one example. The console.log() function is another. -
What is a side effect?
A change in the internal state of the machine in such a way that it 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.
The prompt() function produces the side effect of the dialog box. The console.log() function produces the side effect of printing text to the screen. The Math.max() function takes any amount of numeric arguments and gives back the value which is the greatest. When a function produces a value, it is said to âreturnâ that 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. The order of execution is referred to at the âcontrol flow.â -
What is conditional execution?
Conditional execution is when the program only executes given instructions when certain conditions are met. -
What kind of keyword do you need to use to invoke conditional execution?
In JavaScript, the âifâ keyword is used to create a conditional execution.
- An expression is a combination of values, variables, and operators, which computes to a value.
- A Binding is âtiesâ a value to a variable. It defines a variable.
- The collection of bindings and their values that exist at a given time.
- A function is a piece of code designed to perform a particular task. A function is executed when âsomethingâ invokes it (calls it).
- A function : prompt(âEnter somethingâ);
- Showing a dialog box or writing text to the screen is a side effect.
- Side effect function :confirm Value: math.max
- When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
- Not a single straight route but a branching route, where the program takes the proper branch based on the situation at hand.
- if, else if, and else
- An expression is a fragment of code that produces a value
- A binding is a variable a letter or name that can be used to store a value or expression
- An environment is a collection of bindings and their corresponding values at a given point in time.
- A function is a value with a piece of program that is wrapped inside. This value can be applied in order to run the wrapped program
- Math.max() is an example of a function.
- A side effect is
- alert(âHello Worldâ) produces a side effect and Math.max(4,2) produces a value.
- Control flow is the order/sequence in which expressions, functions or instructions are executed/evaluated in a program.
- Conditional execution is when a program does not take a single route but may take a number of branching routes to arrive at itâs output, deciding which branch based on the situation at hand.
- In JavaScript we use if to invoke conditional execution
- An expression is a code that produces a value.
- It is a function that remembers values.
- The sum of bindings is an environment.
- It is a program wrapped in a value.
- Console.log.
- Is the output of the functions that influence the word.
- alert(âheyâ);
a=5,b=8; c=a+b; - It reads the statement in order.
- It creates a breanching road.
- If.
- An expression is a fragment of code that produces a value.
- Binding is a way to retain or hold a value.
- An environment is a collection of values that exist at a given time
- A function is a block of reusable code that can perform an action, or a piece of program wrapped in a value
- Prompt holds the function that asks for user input
- A change in a way that effects the statements afterward is a side effect, like a popping up dialog.
- A function side effect would be like a dialog box or a message box, an interaction with the outside world. A function that produces a value would be something like 5*5 which would output the value 25.
- Control flow is the idea that code follows a certain pattern or structure, that being that code reads from top to bottom.
- A conditional execution is when a code branches off the top to bottom path to execute another piece of code.
- You can use an if statement to invoke a conditional execution
-
What is an expression?
Anything that produces a value. A fragment of code that produces a value e.g. 1; 1false; -
What is a binding?
Names used to catch and hold value e.g. address, name, number -
What is an environment?
A collection of bindings and their values that exist at a given time is an environment. -
What is a function?
A piece of program wrapped in a value. -
Give an example of a function.
prompt (âWhat is the number?â); -
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.
Math.max produces a side effect and Math.max a value. -
What is control flow?
It is the execution of statements in a program in the sequency they are written. -
What is conditional execution?
It a diversion from the straight control flow of the program. -
What kind of keyword do you need to use to invoke conditional execution?
let, var and const
-
What is an expression?
An expression is a fragment of code that produces a valut. Every value written litterally (45, academy etcâŠ) is an expression. -
What is a binding?
A binding is a special rule in a variable, including a keyword. -
What is an environment?
It is the collection of bindings and their values that exists at a given time. -
What is a function?
A function is a piece of programm wrapped in a value. -
Give an example of a function.
console.log("") -
What is a side effect?
Writting text to the screen is a side effect. ex: prompt("") -
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 would be for example the function alert(""). A function that produces value would be math.max("") or console.log(""). -
What is control flow?
The control flow is the action of executing the code from top to bottom. -
What is conditional execution?
It is the action of giving different options, different paths. -
What kind of keyword do you need to use to invoke conditional execution?
The keyword to us is âifâ.
-
What is an expression?
A fragment of code that produces a value. -
What is a binding?
A binding is a thing that allows you to catch and hold values, a variable. -
What is an environment?
The collection of bindings/variables and their values that exist at a given time is an environment. -
What is a function?
A function is a piece of program wrapped in a value, and such values can be applied/executed to run the wrapped program. -
Give an example of a function.
alert(Give me all your money!"); -
What is a side effect?
Showing a dialogue 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.
alert(âbâ)
math.max(1,2,3); -
What is control flow?
Is when your program contains multiple statements, the program will execute from top to bottom, like a story. -
What is conditional execution?
Used when we want code to be executed only if a certain condition holds -
What kind of keyword do you need to use to invoke conditional execution?
if