-
What is an expression?
A fragment of code that produces a value and used to inspect and process strings of data. -
What is a binding?
They are the connectors to values, but are not the values themselves, therefore multiple bindings can connect to the same value. Bindings need to be connected to some value. -
What is an environment?
It is the collection of bindings and values accessible to Javascript at any given time. -
What is a function?
It is a wrapped set of values organized in such a way so that they run as a computer program. -
Give an example of a function.
console.log(Math.min(2, 4) + 100); (This is useful and might save me using excel sometimes just to find the smallest number of a large list) -
What is a side effect?
It is an expression that could have an effect on future expressions produced by a computer program i.e.) the original expression resides on the computer. -
Give an example of a function that produces a side effect and another function that produces a value.
console.log(âHello!â); (returns the value undefined, but prints the side effect hello) -
What is control flow?
Where a computer program processes statements in the order they appear in the program however, the flow can be branched depending on the code. -
What is conditional execution?
Using the if keyword in Javascript determines which branch the processing of code will follow. -
What kind of keyword do you need to use to invoke conditional execution?
if, else, else if
-
What is an expression?
An expression is a fragment of code that produces a value. It is a snippet of code that evaluates to a value. Itâs not like a statement, because a statement is a snippet of code that performs an action. Expressions only produce values but not actions. If an expression corresponds to a sentence fragment, a statement corresponds to a full sentence.
Any value that is written literally, such as 33 or âFrancineâ is an expression. -
What is a binding? (let, var, const)
Binding is used to make the computer remember things. It is a way to have the computer catch and hold values. Binding allows us to set which object will be bound by a certain keyword when a function or method is invoked. It is like tentacles, it grabs a value but it does not contain them.
After a binding has been defined, itâs name can be used as an expression. The value of the expression is the value of the binding that it currently holds. However, when a binding points to a value, it doesnât have to be tied to that value forever. I can use = to point the binding to a new value.
Ex:
let mood = "light";
console.log(mood);
/ / --> light
let mood = "dark";
console.log(mood);
/ / --> dark
-
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. -
Give an example of a function.
As an example, in a browser environment, the binding prompt holds a function that shows a little dialog box (pop up window) asking the user for input.
EX:
prompt("Enter passcode");
-
What is a side effect?
A statement could display something on the screen that counts as changing the world, or it could change the internal state of the machine in a way that will affect the statements that come after it. These changes are called side effects.
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.
Functions can produce side effects and also values.
-An example of a function that produces a side effect is the function prompt.
Ex:
prompt("Enter passcode");
-An example of a function that produces a value is the function Math.max. It takes any amount of number arguments and gives back the greatest.
Ex:
console.log(Math.max(2, 4);
/ / --> 4
-
What is control flow?
The control flow is the order in which the computer executes statements in a script. In this case is from top to bottom. -
What is conditional execution? (if)
We use conditional execution (if) when we want some code to be executed only if, and only if a certain condition holds. Itâs like creating a branching road that allows the computer to take the proper branch based on the situation at hand. -
What kind of keyword do you need to use to invoke conditional execution?
I need the keyword if.
- An expression is any fragment of code that results in a value.
- A binding is a value or string set to a variable, it helps to make binding so you donât have to write out the same expression multiple times in the program.
- An environment is all off the bindings that have been made within a program.
- A function is a section of the program that performs a specific task. It can then be called upon for use in other expressions.
- alert(" alert is a function");
- A side effect is an observable change in the state of the application.
- console.log produces side effect and Math.max produces a value.
- Control flow is the order in which the computer executes statements in a script.
- Conditional execution is a function that allows the program execute some code if the statement provided agrees with the condition.
- IF
- A fragment of code that produces a value.
- Binding or variable is the thing that connects two values.
- The collection of bindings and their values that exist at a given time.
- A function is a piece of program wrapped in a value.
- For example prompt holds a function that shows a little dialog box asking for
user input. - Showing a dialog box or writing text to the screen is a side effect.
- Side effect example: prompt(âEnter your ageâ); value example: console.log(Math.max(2,4))
- Control flow is the order in which we code and have our statements evaluated.
- Conditional Execution is a branch in the control flowâs execution, where JavaScript picks a branch depending if the conditions that are present.
- If and else
-
An expression is either a complete or fragmented valid statement, evaluated to produce a value. An example of a simple expression is: 6; // the produced value of this expression is 6. Another example is:
Apple + 6; // the produced value from this expression is "Apple6"
-
A binding allows a newly generated value to be stored internally for future use. It can be defined by the keyword
let
orvar
followed by the bindingâs name and then assigned to an expression. -
The environment is a collection of bindings that exist at a given time. There will always be a collection of bindings regardless of the programâs state.
-
A function contains statements of expressions that are wrapped in a value. It can accept values as inputs and will derive an output based on what statements it contains. For a function to output a value, it needs to be invoked by putting parentheses after an expression that produces a function value.
-
The prompt function is a built-in JavaScript function that takes a string value and displays it as text to show in the dialog box. It is written as
prompt("Input string here");
. -
Example of a function that produces a side effect:
alert("Hello world"); // Displays a box containing the text "Hello World"
Example of a function that produces a value:
console.log(5 + 4); // Results the value 9
-
A side effect is an observable change made by a function. An example of this would be a prompt function because it displays a dialog box to the screen.
-
If there is more than one statement, the computer will read the statements in order from top to bottom - called a control flow.
-
A conditional execution only happens when the condition set in an
if(condition)
statement is true. This modifies the control flow by creating different branches using differentif
statements. -
if
andelse
Reading Assignment: Binding, Functions and Control Flow
Think about the following questions while reading:
What is an expression?
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.
What is a binding?
It is a way for javascript to catch & 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.
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.
SIDE EFFECT:
console.log(prompt (âjonathonâ));
VALUE:
console.log(Math.max(2, 4));
// â 4
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?
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.
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
ELSE
- A fragment of code that produces a value.
- A variable (name that is binded to a value- think tentacle, not box)
3.Collection of bindings and their values at any given time - A Piece of programme wrapped in a value
- prompt
- Observable changes which occur as a result of a javascript statement
- console.log produces a side effect Math.max produces a value
- When there is more than one statement, they are executed like a story from top to bottom
- A programme which is not a straight road, there are branches which the code follows based on the situation
- if and else.
-
An expression is a fragment of code that produces a value.
-
A binding is an expression that ties a name to a value.
-
An 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.
-
prompt(âHow are you?â);
-
a statement that changes the internal state of the machine in a way that will affect future statements
-
var x = 2;
-
Control Flow is the order in which statements are being executed in a program.
-
Conditional Execution is when an if statement is used in a program to produce an output when defined conditions are met.
-
If
- An expression is a segment of code that evaluates to something.
- A binding is what points a variable to a value.
- An environment is a collection of bindings.
- A function is a program that is wrapped in a value.
- Examples: console.log(), alert()
- A side effect is a secondary action that results from calling a function.
- An example of a function that produces a side effect is alert() because it shows a dialogue box. An example of a function that produces a value is Math.max(2,4).
- Control flow is the order in which the code is executed, like top to bottom.
- Conditional execution means executing a segment of code depending on the state of a conditional statement.
- if
-
A fragment of code which evaluates to a value.
-
It is a place holder for a value. It can be modified and used in an expression.
-
A collection of bindings (values ) that exist at any given time. When a program starts up it initializes values to create an environment.
-
A function is an enclosed program that performs a specific task.
-
alert(" system error 1 "); Notify user of system error.
-
An operation to modify some kind of external state. For example a function displaying a message to the Console display or requesting input from the user.
-
A side effect function is - prompt(" Input your name") - displays a dialogue box and requests user .input.
A function producing a value - Math.min( 2 , 4); returns the minimum value 2. -
The order in which program statements are executed, for example, top to bottom for a inline sequence.
-
When a program makes a conditional test the result causes the program to take path A or B.
-
A keyword which performs a conditional test is â if ( x>y) {âŚ}.
-
An expression is a fragment of code.
-
A binding or variable is where a program stores values
-
An environment is a collection of variables and their values.
-
A function is a piece of a program that is wrapped in a value. i.e. A prompt is a function that shows a dialog box for a userâs input.
-
An example of a function is the alert function where it displays an alert box with data for the user.
-
Showing an alert or dialog box is a side effect.
-
Prompt(âEnter ageâ); has the side effect.
console.log(2+2); Shows a value. -
Control flow is the order of the statements or program that executes the code. From top to bottom
-
Conditional executions is where you create a program to branch off. Usually through a if statement.
-
If and ElseâŚ
- What is an expression?
a piece of code that return a value - What is a binding?
binding is the process used in javascript for the program to remember a value. Binding is a variable - What is an environment?
A collection of bindings - What is a function?
Functions are special values that encapsulate a piece of program - Give an example of a function.
var number = 1; console.log (Number); - What is a side effect?
- Give an example of a function that produces a side effect and another function that produces a value.
ie prompt / sum - What is control flow?
forms to control the direction the program is executed - What is conditional execution?
it´s the ability to execute a code only if certain conditions exists and it is introduced with âifâ - What kind of keyword do you need to use to invoke conditional execution?
If
-
Is a fragment of code that produces a value.
-
A bindings allow us to catch and hold values, using the keyword âletâ, followed by a name that we want to give to the binding.
-
The environment is a collection of bindings and their values that exist at a given time. An environment always contains bindings that are part of the language standard, e.g Browser environment.
-
Is a piece of program wrapped in a value.
-
alert(âHi there!â);
-
A side effect is any application state change that is observable outside the function other than its return value.
-
console.log(Math.min(2,7,10));
â> 2 -
Control flow refers to the path execution of statements takes within a program, from top to bottom.
-
Conditional execution provide us to create a branching road that will execute only if some prescribed condition is met.
-
If and else.
1 - An expression is the result of a piece of code that produces a value. A value that is written literally is classed as an expression. An expression written between parentheses is also classed as an expression. Binary operators applied to 2 expressions and unary operators applied to 1 expression are also expressions.
2 - Binding is used to catch and hold values. An example is;
let caught = 5 * 5
âletâ defines a binding operation is to occur.
âcaughtâ is the binding operation. This operation âgrabsâ the value produced by 5 * 5. Once the operation has been defined it is now called an expression.
The value of an expression is the value the binding currently holds. The binding will not be tied to any one value forever. The = operator can be used to point the binding towards a new value - thus disconnecting it from its current one.
3 - An environment is a collection of bindings and their associated values that exist at a given time.
4 - Functions are pieces of code that perform particular tasks. A function is executed once it has been invoked. A function can be defined as:
Function name (parameter1, parameter2 etcâŚ) {
// code to be executed
}
Function parameters are listed inside the parentheses.
Function arguments are the values received by the function once it has been invoked.
5 - prompt("Enter your name)
6 - Some functions will produce what are called âside effectsâ, and example of one is a dialogue box.
7 - prompt(âPlease enter your ageâ) --> This will produce a side effect.
console.log(Math.max(2, 4) + 100; --> This will produce a value.
8 - If a program has more than one statement, then the statements will be executed in order, from top to bottom.
9 - A conditional execution is used using the if function. This tells the program to only execute if certain conditions are met.
10 - If and else are keywords needed to invoke a conditional execution.
- It is a fragment of a code that produces a value.
- Binding is a way a program keeps an internal state, by defining and storing a variable (binding) for future use.
- It 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, which is executable.
- prompt(âHow are you todayâ);
- A side effect is any observable result that is outside the functionâs scope.
- alert(âGo Go Go Go Go we are LIVEâ); --> a pop up box
var Go = 1;
console.log(Go+Go+Go+Go+Go); --> 5 (a value) - It is the order the program executes the statements.
- Conditional execution is created with the âifâ keyword and statements are executed if certain condition(s) hold(s).
- I responded above in 9. The keyword is âifâ.
- An expression is a resulting value from other values either binded or calculated through an operator.
2.Binding is the âleashâ that is created to a certain value. It can be attached to a previous set of values.
- An environment are where all the expressions and bindings are designated. You can say its both a Glossary and Dictionary of all programs beneath it.
4.A function is a âwrappedâ program or previous made expression wrapped into a Value. This allows an expression to continue its properties used elsewhere represented as a Value
5.alert(âPlease input your name and passwordâ)
- A side effect is when a function creates something within that program. An alert is a function causing it to create something or give something of value.
7.(Side Effect) We can use the !Number.isNan function that asks for a number value for it process an expression.
(Value) A function can be console.log which outputs it to the Console of the browser.
8.Control Flow is the orientation of the program. Some values can be redirected if changed or designated later down the flow of the programming.
9.Conditional Execution is a function that will âtriggerâ once certain conditions are met. In the example of !Number.isNan prompt, if a Value of a number is not entered, it will not continue down the functions in the order of the programming
10.âifâ and or âletâ followed by designated value to that specific expression
- What is an expression?
an expression is a part of code which produce a value.
- What is a binding?
A binding is the name we assign to a value
- What is an environment?
the environment is the total of all the values and variable existing at a given time.
- What is a function?
a function is a part of a program tied to a value, which perform a specific task
- Give an example of a function.
var number = prompt(âinsert a numberâ)
- What is a side effect?
A side effect is something generated automatically by a value.
- Give an example of a function that produces a side effect and another function that produces a value.
the function on point 5 is an example
- What is control flow?
The control flow is the path a program follow reading the strings while being executed.
- What is conditional execution?
A conditional execution is when a parts of the program will be executed only if they meet some conditions.
- What kind of keyword do you need to use to invoke conditional execution?
If, else
- A fragment of code that produce a value is called an EXPRESSION
2)Biding is an especial word that indicates a value by an = operator and an expression
3)is a set of variables and their values that exist in memory at given time - Function is a piece of program wrapped in a value
- prompt(âEnter pass codeâ);
6)the side effects holds a function that shows a little dialog box asking for user to input.
7)COMMAND_OPTION_I (effect)
Math.max,and the opposite Math.min (value) - Control flow is when your program contains more than one statement 'the statement are executed from top to bottom.
9)is a branching road - keyword is: if and else
-
What is an expression?
Fragment of code that produces value. -
What is a binding?
short term memory of a previous value. Catch and hold value. -
What is an environment?
Collection of bindings and their values. -
What is a function?
Piece of program to execute a specific task. -
Give an example of a function.
Console.log -
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. Side effects include: Modifying any external variable or object property (e.g., a global variable, or a variable in the parent function scope chain) -
Give an example of a function that produces a side effect and another function that produces a value.
Side Effect ; Prompt
Return Value; Math.max -
What is control flow?
The order of execution of statements -
What is conditional execution?
Gives the program different path to choose from, based on different sets of conditions. -
What kind of keyword do you need to use to invoke conditional execution?
If, else
- What is an expression?
Expression is binding that currently holds a value - What is a binding?
Binding is giving element a value so it can be stored in it - What is an environment?
Collection of binding and their values - What is a function?
A function is a piece of program code wrapped in a value. It can be executed by calling it - Give an example of a function.
prompt(âEnter your passwordâ); - What is a side effect?
A side effect may speak to the internal machine, for future statements - Give an example of a function that produces a side effect and another function that produces a value.
- What is control flow?
Control flow is statement executed by the order as they are meant to do - What is conditional execution?
Conditonal execution is in simple case executed only if a certain condition is (true) - What kind of keyword do you need to use to invoke conditional execution?
Keyword âifâ