-
An expression is a fragment of code that produces a value.
-
A binding, also known as a variable binds a value to a phrase and saves it in the log to be used later in the programming.
-
An environment consists of predetermined values that are already bound beforehand. An example is the standard language of Javascript.
-
A function is a piece of program wrapped in a value. Values can then be applied to run the wrapped program.
-
One example is the function prompt which asks the user to input a response such as a number or phrase.
-
A side effect causes a change in the webpage to the user such as a dialog box or writing text to the screen.
-
side effect: prompt(âenter a numberâ); value console.log(Math.max(3, 5));
-
Control flow reads like a story from start to finish executing the program coded one step at a time down the line.
-
A conditional execution allows a program to take varying paths to achieve the proper solution, not simply a straight road.
-
if and else are two examples that can be used.
- An expression is a piece of code that evaluates down to one value. It can contain values, operators, variables, and even other expressions but as long as it will evaluate down to one value than it is an expression.
- a binding is a statement that names a variable than links a value to that variable.
- The environment is all the bindings and the values attached to them that exist in the program right now.
- A function is a program assigned to a value. you can run the program by calling that value followed by parenthesis. Most functions require you to put one or more arguments into the parenthesis.
- Math.abs() is a function that requires one argument and it returns the absolute value of a function. For example if you pass in the argument of -4 it will return the value of 4.
- A side effect is something that happens on the webpage when a function is ran other than just a value being returned.
- The confirm() function produces a side effect. it is very similar to the prompt function but instead of a text box for the user to input data it just produces text and the user can then press ok or cancel. If the user presses ok the function returns the boolean value true and if they press cancel it returns false.
and the function Math.max produces a value. - Control flow is the order in which the statements are executed when a program is run.
- Conditional execution is when certain keywords are used to determine which statement will be executed next based on the situation.
- if, else
-
An expression is a code fragment that produces a value.
-
A binding is the given to the operation when a value is linked to a named binding which can thereafter be reference just by using the binding name, It is the way Javascript maintains state within a program.
-
Am environment is the name given to the collection of defined bindings at any given point in time.
4.A function is a piece of program that is referenced and called by invoking its function name.
-
For example prompt is an inbuilt system function to request input from a user.
-
A side-effect is an action produced by a function such as showing a dialogue box or displaying text on the screen.
-
The alert function produces dialogue boxes and the function Math.abs produces a value which is the absolute value of the value passed to it (ie. without sign).
-
Control flow is how the step by step movement between operations in a program is controlled.
-
Conditional execution is when at a certain point in a programs flow the future direction of flow is dictated by the value of an expression and depending on whether it is true or false the program will take a different path.
-
To invoke conditional execution you need a keyword such as if, else or switch.
-
What is an expression?
A fragment of code that produces a value. -
What is a binding?
Binding also called variable, used to catch and hold values. The (keyword) âletâ indicates that this sentence is going to define a binding. -
What is an environment?
Collection of bindings and their values, that exist at a given time. -
What is 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.
Prompt(âenter passcodeâ); -
What is a side effect?
Writing a 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.
The function Math.max -
What is control flow?
When the statements are executed as a story from top to bottom. -
What is conditional execution?
When the program donât take a straight road but branching road, it depends on the actual situation. -
What kind of keyword do you need to use to invoke conditional execution?
if keyword.
- What is an expression?
An expression is a fragment of code that produces a value.
- What is a binding?
A binding (or variable) is a way to catch and hold values (such as using a variable in this example: let color = âgreenâ; ).
- What is an environment?
An environment is a 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.
- Give an example of a function.
console.log();
- What is a side effect?
A side effect is the concept of a function that can alter the external state of your application; for example, a function, when run, that can alter parts or values of your application that donât reside directly inside the same method.
- Give an example of a function that produces a side effect and another function that produces a value.
Side effect: console.log(âHello World!â); (running this function produces the side effect of writing something to the console window);
Function that produces a value: console.log( Math.max (6, 8) ); (running this function produces the value â8â)
- What is control flow?
Control flow is the order in which statements in a program are executed.
- What is conditional execution?
Conditional execution means that code will be executed only if certain conditions are met.
- What kind of keyword do you need to use to invoke conditional execution?
To invoke conditional execution, use the keyword if
.
1 an expression is a piece of code that produces a value
2. a binding is a word that is linked to an expression or program
3. the environment is where bindings and values reside
4. a function is a wrapped program associated with a value
5. function Total (Eth, Btc)
return (Eth + Btc); {
console.log ("the amount is" +Total);
}
6. the side effect is the outcome of an expression, it imparts some effect of change on the world or code
7. prompt ("hi there"); this produces side effect
function apples (redones, greenones)
return (redones + greenones); {
console.log ("result is" + apples);
}
this is producting a value
8. the sequence at which statements are executed
9. a condition execution produces an output should certain conditions be met
10. if
- An Expression is a fragment of Code that produces a value
- A Binding Catches and Holds a value
- An Environment is group of bindings, along with their assigned values, that exist at a given time
- A Functions is a piece of Program wrapped in a value such as the default âpromptâ
- Console.log
6 A Side Effect is the change of the âworldâ or âinternal machineâ that will effect all of the statements that come after it. - prompt(âEnter Passwordâ); creates a side effect and console.log produces variables
- Control Flow is like a book reading statements in order and left to right, but they can be made conditional,
- Conditional Execution is IF âŠa is returned, take route a, if be is returned then take route b, splitting the control flow
- if, else,
- What is an expression?
A fragment of code that produces a value - What is a binding?
Its an expression used to to catch and hold values. - What is an environment?
The collection of bindings and their values that exist at a given time - What is a function?
Is a piece of program wrapped in a value - Give an example of a function.
console.log - What is a side effect?
Showing a dialog box or writing text to the screen. 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.
Side effect Alert value Math.max - What is control flow?
The control flow is the order in which the computer executes statements in a script - What is conditional execution?
When we want to create a branching road, where the program takes the proper branch based on the situation at hand. So the execution will take place given a condition. - 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. Every value that is written literally (such as 22 or âpsychoanalysisâ) is an expression.
-
When you combine a special keyword to a variable.
-
The collections of bindings and their values that exist at a given time is called the environment.
-
A lot of the values provided in the default environment have the type function. Aa function is a piece of a program wrapped in a value.
-
prompt(âEnter Passcodeâ);
-
If a statement or function modifies the state of something else outside its own space then it produces a side effect.
a=1
b=2
How many buildings do we own?
enter the passcode?
1
enter how many code pads there are?
2
var a = 1
var b = 2
alert(âHow many buildings do we own?â);
var a = prompt(âEnter the passcode?â);
Console.log(a);
var b = prompt(âenter how many code pads there are?â);
console.log(b)
console.log(âHow many buildings do we own?â, (b-a));
how many buildings do we own? //The Answer is we own 1 building.//
-
When your program contains more than one statement, the statements are executed as if they are a story from top to bottom.
-
We want to create a branching road where the program takes a proper branch based on the situation at hand.
-
conditional execution is created with the ( if keyword) in Javascript.
1. What is an expression?
Apparently even a single value is an expression. Or adding two values with an operator is also an expression. Two expressions connected with an operator is also an expression. An expression always returns a value.
2. What is a binding?
A binding is a variable that is connected to a value.
3. What is an environment?
The environment is the collection of variables that exist at a given time while the program is running.
4. What is a function?
A function is a piece of program that performs a task. A function can be invoked by calling it. A function can accept arguments and return values.
5. Give an example of a function.
I tried to write a simple function, it is probably totally wrong, but it worked:
let a=1;
let b=2;
let test=0;
function addNums(a,b) {
return(a+b);
}
test = addNums(a,b);
console.log(test);
6. What is a side effect?
A side effect is a result of the program that âchanges the worldâ, like for example displaying something on the screen, or a change in the state of the program.
7. Give an example of a function that produces a side effect and another function that produces a value.
Example for side effect:
console.log(âside effectâ);
Example for pure function:
Math.max(a,b);
8. What is control flow?
It is the order of exectution for the statements in my program.
9. What is conditional execution?
Conditional execution will check a criteria and depending on wetaher this criteria is met or not it will execute ot not.
10. What kind of keyword do you need to use to invoke conditional execution?
you could use: if, else, while, do while, for
- What is an expression? A fragment of code that produces a value.
- What is a binding? An expression to catch and hold value.
- What is an environment? The collection of bindings and their values.
- What is a function? Is a piece of program wrapped in a value.
- Give an example of a function. Function prompt for entering the password.
- 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. E.g. function prompt produces a side effect in the shape of dialog box, while console.log(Math,max(1,2)) produces the highest value.
- What is control flow? It is the order of execution of the code - like a story.
- What is conditional execution? When a program has side branches (e.g. ifâŠ)
- What kind of keyword do you need to use to invoke conditional execution? IF
-
any kind of code that produces a value
-
binding is a way for a computer to remember something. it can be used to tie an expression to a name
-
An environment is the collection of binding and their values at any given point in time
-
a function is a piece of a program wrapped in a value
-
prompt(âEnter Passwordâ);
-
when a function causes changes to something outside of that function it is known as a side effect
-
function that produces value: console.log(Math.max(2, 4));
-
the control flow is the order in which the statements in the code are read by the computer
-
conditional execution is where the program takes different directions based on the situation
-
to invoke a conditional execution you can use the keyword if
- a fragment of code that produces a value
- it catches and holds values
- collection of bindings and their values that exist at a given time
- a piece of program wrapped in a value
- a prompt function that asks for user input
- showing a dialog box or writing text to the screen is a side effect
- prompt(write something) - side effect
console.log(10+2) - value - When statements are executed from top to bottom
- a program executes a code based on the situation at hand
- IF, else
- An expression is a fragment of code that produces a value; as well as every value that is written literally.
- A binding is what catches and holds values, so that the program can remember things and maintain its internal state; also known as a variable. The values held are not âfixedâ as they can be changed if necessary later on.
- An environment is where a collection of bindings and their values exist at a given time.
- A function is a piece of program wrapped in a value. Those values are called arguments.
- An example of a function is as follows:
alert(âWelcome!â) - A side effect is when the screen shows a dialog box or writing text.
- An example of a function that produces a side effect is:
prompt(âType your name here:â)
and one that produces a value is:
console.log(4+6); - Control flow is how the program is arranged so that the functions are executed in a certain order; as the statements are laid out from top to bottom and read this way in the program so that every function that follows can rely on the previous ones as necessary.
- Conditional execution is implemented when we want to create a branching road, where the program takes the proper branch based on the situation at hand.
- The keyword needed to invoke conditional execution is âifâ
What is an expression?
Ans: An Expression is a fragment of code that produces a value
What is a binding?
Ans: Aka variable that that catches and holds values.
What is an environment?
Ans: The collection of bindings and their values that exist at a given time is called
the environment.
What is a function?
Ans: 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.
Ans: alert(âHitesh is AWESOME!â)
What is a side effect?
Ans: Anything that when expressed changes the world or change
the internal state of the machine in a way that 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.
Ans: prompt(âEnter passcodeâ) is a function that produces a side effect. console.log(Math.max(2, 4))is a function that
produces a value.
What is control flow?
Ans: Control flow is the order in which a program will execute the code(from top to bottom)
What is conditional execution?
Ans: 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?
Ans: the if keyword
What is an expression?
Code that produces a value such as 22 or âpsychoanalysis
What is a binding?
It is a variable that can bind a function or expression permanently
What is an environment?
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
Give an example of a function.
The prompt function opens a dialog box for input
What is a side effect?
A statement that âchanges the worldâ or the internal state of the machine that will affect statements after it.
Give an example of a function that produces a side effect and another function that produces a value.
prompt would produce a side effect, math.max gives a value.
What is control flow?
The order in which statements are resolved
What is conditional execution?
it is when there is more than one branch of programming, which is taken is decided by the conditions when the fork is reached
What kind of keyword do you need to use to invoke conditional execution?
if
- A fragment of code which outputs a value is an expression.
- A binding, also called variable, is a named storage for holding a value. It allows a program to keep an internal state. A binding can be defined with one of the keywords var, let or const.
- The environment is the collection of all bindings with their values that exist at a given point of 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.
- function side Effect(){ console.log(âHelloâ) }
function pure Function(a) { return a + 1 }. - The order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.
- When a block of code is executed only if a condition is met.
- if and else.
- A fragment of code that produces a value
- Binding is the name for a situation when you use for example the keyword let to catch and values.
- The collection of binding and their values exist at a given time.
- a piece of program wrapped in a value
- alert (âYou look good todayâ);
- If a statement or expression alters something in the program.
- value: console.log(Math.min(2, 4) + 100) side effect: Name=prompt(âWho are you?â);
- The program will run the code like telling a story, top to bottom.
- If you want to create a branching road in a situation
- âifâ
- What is an expression?
- What is a binding?
- What is an environment?
- What is a function?
- Give an example of a function.
- What 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?
- What is conditional execution?
- What kind of keyword do you need to use to invoke conditional execution?
1- An* Expression is a fragment of code that produces a value
2- Binding refers to the act of internally assigning a value to a variable. It is done by using the keyword let
3- An* Environment: is a space within which bindings and their corresponding values exist at a certain period of time
4- A* Function: is a small code/set of instructions wrapped in a value - executing a function is called calling, applying or invoking it - a value given to a function is called an argument
5- An example of a function:
6- A side effect refers to a function ability to modify the state of its external environment beyond the property of returning a value
7- example of side effect vs returned value:
8- * control flow is the order in which programs are executed, from top to bottom left to right, or according to a « chronological » order - the first statement gets executed first, then the second, the thirdâŠ
9- * Conditional execution is the creation of branching roads within a program - it is created using the if keyword - in this case, a piece of a program is executed only when a specific condition is met -
10 *- If then else keywords are used to invoke a conditional execution
-
What is an expression?
A fragment of code that produce a value -
What is a binding?
Tentacle that contains 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?itÂŽs a piece of function wraped 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 -
Give an example of a function that produces a side effect and another function that produces a value.
SIDE EFFECT
console.log(Math.max(2, 5));
// â 5
VALUE
console.log(Math.min(1, 4) + 1000);
// â 1001 -
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?
Its when the program takes the proper branched base on the situation (conditional) -
What kind of keyword do you need to use to invoke conditional execution?
If