- What is an expression?
-> An expression is a fragment of code that produces a value. - What is a binding?
-> binding, or variable, is a way to store and reference a value via a tag. - What is an environment?
-> 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.
-> prompt (“Enter passcode”); - What is a side effect?
-> A side effect of a function is the result of the function that does not return a value, for example writing something on the console or showing a dialog box. - Give an example of a function that produces a side effect and another function that produces a value.
-> console.log (“Hello World”); // produces a side effect
Math.max (2,4); // produces a value - What is control flow?
-> Control flow refers to the execution order of the functions in the code, from top to bottom - What is conditional execution?
-> conditional execution allow us to write code that will execute only if some conditions are met - What kind of keyword do you need to use to invoke conditional execution?
-> to invoke a conditional execution, you use the keyword “if”
-
An expression is code that produces a value.
-
A binding is a method to catch and hold a value rather than it disappearing.
-
An environment is a collection of bindings and their associated variables that exist at a given time.
-
A function is a piece of program wrapped in a value.
-
An example of a function is prompt code. This function invokes a dialog box to come up and receive input.
-
A side effect is just that, an effect caused by code that either creates written text or maybe causes a dialog box to appear.
-
An example of a function that produces a side effect is alert (“Hello World”);… A function that produces a value is console.log(Math.max(2,4,6)); which would produce “6” as a resulting value.
-
Control flow is when the program has only one “direction” and it’s read top to bottom.
-
Conditional execution is where the program has possible divergent paths rather than one direction. There could be a branch (or many.)
-
To invoke conditional execution you use “if”
- What is an expression?
An expression is a fragment of code that produces a value. - What is a binding?
A binding is what Javascript provides 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?
A piece of program wrapped in a value. - Give an example of a function.
The prompt function. - What is a side effect?
Changes in a statement, that stands on its own amounts to something only if it affects the world. It 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. - 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))
// -> 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?
Occurs when we want to create 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?
‘’ if ‘’ and ‘‘else’’ .
- What is an expression?
Code the produces a value. - What is a binding?
A binding is the link between an expression and it’s value. If the expression does not link to a value then it is undefined. They must not start with a digit and the only special characters they can be named with include $ and _ . They also cannot be keywords or reserved words. - What is an environment?
The environment is the entire set of bindings and their values 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.
For example, when the binding prompt is used, it’s function creates a dialog box for user input. - What is a side effect?
A side effect is the action of interacting with the functions, such as something appearing on screen, or an input being typed by a user. - Give an example of a function that produces a side effect and another function that produces a value.
Side effect: alert(“You’re late!”); Value: (num1 + num2)= - What is control flow?
The order in which functions are executed in a program. - What is conditional execution?
A conditional execution creates an alternate flow for executing the program based upon different states of the environment. - What kind of keyword do you need to use to invoke conditional execution?
The keyword if.
-
An expression is a fragment of code that produces a value.
-
JavaScript provides binding to catch and hold values. It mostly does the same thing as defining a variable.
-
The environment is the collection of bindings and their values that exist at a given time.
-
A JavaScript function is a block of code designed to perform a particular task when it is invoked.
-
console.log(“Example”)
-
Side effects are any state change that can be seen outside of a function call, with the exception of the function return value.
-
Showing a dialog box or writing text to the screen is a side effect. A function that produces value would be a mathematical function (1+1).
-
When the program contains more than one statement, the statements are executed from top to bottom.
-
We use conditional execution if we want different blocks of code to be executed depending on whether the condition is true or false.
-
We use the keyword IF.
- An expression is a piece of code that declare something
2)It is a variable: created for store a value
3)It is a collection of bindings - A function is a piece of program wrapped in value
- function sum(a,b){
sum = a + b;
return sum;
} - writing text on the screen
- side effect: prompt(“Enter your name”)
value example: console.log(a+b) - when you function contain more than one statement
- A function with more than one possible end, depends from the variables
- if
-
An expression is a fragment of code that produces a value.
-
A binding allows the program to reference a given value. ie. let one = 1
-
An environment is the collection of bindings and values that exist.
-
A functions is a piece of program wrapped in a value.
-
An example of a function is invoking “prompt” which shows a dialog box allowing the user to enter an input.
-
A side effect results in showing a dialog box or writing text to the screen.
-
An example of a function that produces a side effect is the prompt function. A function that produces a value is Math.max.
-
Control flow is the program executing statements from the top to bottom similar to the way we reaad a story.
-
Conditional execution is when you create a branching road using the “if” keyword where the program takes the proper branch based on the situation at hand.
-
The “if” keyword invokes conditional execution.
Think about the following questions while reading:
- What is an expression? A fragment of code that produces a value.
- What is a binding? To catch and hold values as binding
- What is an environment? The collection of bindings and their values available at any given moment in time.
- What is a function? A piece of program wrapped in a value.
- Give an example of a function. Prompt(“enter password”);
- What is a side effect? Showing a dialog box or written text to the screen
- Give an example of a function that produces a side effect and another function that produces a value. Console.log(math.max(2,4));
- What is control flow? When a program contains more than once statement
- What is conditional execution? When creating 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? if
-
What is an expression?
Is the building block of a program, it allows us to build complex expressions that execute a program -
What is a binding?
It is the way the program remembers things, we can assign words to a value and the computer will remember it. -
What is an environment?
It is a collection of binding and its value that exist in a particular time. -
What is a function?
A function is a piece of program wrapped in a value. -
Give an example of a function.
An example is “enter in your password” & “what is your name” -
What is a side effect?
Changes that can effect the world, is called a side effect. -
***Give an example of a function that produces a side effect and another function that produces a value.
The first is “input” function that will cause a side effect, the second is Math function that will give 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?
Conditional execution is when the program has to make a decision between two choices. -
What kind of keyword do you need to use to invoke conditional execution?
If
1- An expression is a fragment of code that produces a value.
2- A binding or variable is a way to ct satch and hold values.
3- An environment is a collection of bindings and their values that exist at a given time.
4- A function is a piece of program wrapped in a value. Such values can be applied to run the wrapped program.
5- The binding prompt holds a function that shows a little dialog box aking for user input.
6- A side effect is any application state change that is observable outside the called function other than its return value. Showing dialog box or writting text to the screen is a side effect.
7- Prompt produces a side effect and Math.max a value.
8- Control flow is the order in which the computers execute statements in a script.
9- Is an execution that takes the proper branch based on the situation at hand.
10- Keywords If and else.
What is an expression?
It is a fragment of code that produces a value.
What is a binding?
Binding is used for catching and hole values in a program.
What is an environment?
Is a collection of bindings and values that exist at a given time.
What is a function?
A function a piece of program wrapped in a value.
Give an example of a function.
A function is like a mini-program that can be bound to the code needed to perform a specific task.
What is a side effect?
is a statement that stands on its own that displays something that changes the world or the internal state of the machine.
Give an example of a function that produces a side effect and another function that produces a value.
This produces a side effect,
prompt("Please enter your name: ")
This produces no side effect,
var a = Math.min(34, 56, 234, 7);
What is control flow?
Each statement is executed in order from top to bottom.
What is a conditional execution?
conditional execution happens when a condition is met or not met and will control what code is to be executed.
What kind of keyword do you need to use to invoke conditional execution?
if
else
1.A small piece of code that produces a value, e.x.: a number or a letter. Expressions combined with operators and semi colons make a statement.
2.A binding is a way how a program keeps a value stored for it to be reused. Typical format is a keyword + binding name = value // ex.: let number = 2
3.An environment are all bindings and values that exist in a certain program.
4.a function is a piece of program wrapped in a value that performs a specific task and then can be reused in other expressions.
5.alert(‘this is a test’);
6.If a statement or function changes the state of something outside its own scope, then it produces a side effect, e.x.: alert() function shows you a pop up box - that is a side effect
7.No side effect- console.log(‘example’);
With side effect- prompt(‘example’);
8.When a program has more than one statement, the program is executed from left to right/top to bottom and that is control flow.
9.Its basically giving a program different choices/branches of how it can execute/flow.
10.If else / switch
-
What is an expression?
An expression is a fragment of code that produces a value. Expressions can be a value, an operator, or a nested combination of these. -
What is a binding?
A binding is a type of variable that points to data stored elsewhere. At any time, the binding can be changed such that existing bindings point to a different value. -
What is an environment?
The environment is the collection of bindings and their values, and is usually pre-loaded with everything that a program will need to interact with the system running it even before runtime. -
What is a function?
A function is a named block of code, that executes some specific, predetermined set of instructions. It can accept arguments (variables that need to be passed into the function) and can return values when the function has been invoked. -
Give an example of a function.
getAnswer(theQuestion); -
What is a side effect?
A side-effect is a change to a variable made by a statement that does not directly affect the real world, i.e it does not change anything to be rendered on screen or controls any hardware - but affects some of the statements that come after it that do. -
Give an example of a function that produces a side effect and another function that produces a value.
console.log(“hello world”)
alert(2+4); -
What is control flow?
Control flow refers to the order in which the statements are executed. -
What is conditional execution?
Conditional execution allows programs to execute any number of parallel code options in reponse to a given state or variable. -
What kind of keyword do you need to use to invoke conditional execution?
IF!
- An expression es every value.
- Binding is used top catch and hold values. It doesn´t contain values.
- An environment is a collection of all bindings.
- A function is a piece of program wrapped in a value.
- An example of a function:
console.log(prompt(“Enter your name”)); - A side effect is a when a dialog box or writing text is shown on the screen.
- Example of a function that produces side effect:
console.log(prompt(“Enter your name”));
Example of a function that produces a value:
console.log(Math.max(2,4)); - A control flow: when a program contains more than one statement, the statements are executed in order, from top to bottom.
- A control execution is an execution of conditional sentences based on different conditions.
- Keywords used to invoke conditional execution are: IF, ELSE, ELSE IF.
- An expression is anything that produces a value.
- Bindings are the names we assign to variables to retain the information in the computer’s memory.
- An environment is a collection of bindings and their values at a given time.
- A function is code that does something to/with a value, (5) for example, console.log or prompt.
- A side effect occurs when existing data is modified, rather than simply producing a value.
- console.log is a function with a side effect. Math.abs is a function that produces a value.
- Control flow is the order in which expressions are executed.
- A conditional execution is code that is executed if and only if a set condition is met.
- We invoke conditional executions with the keyword, “if,” and sometimes “else.”
- a fragment of code that produces a value
- binding is giving an element a value so it can be stored in it.
- is a collection of bindings and their values in a certain frame of time.
- a piece of program warped in a value, is a price of code that performs a specific task and usually returns a value.
- prompt, alert, console.log
- If a statement or function modifies the state of something else (outside its own scope), then it is
producing a side effect. - prompt(“Enter your name”);
value example
console.log(Math.max(2, 4));
it will output a value that is 4 - Control flow is wow the program is executed (from top to bottom).
- is a function that allows the program execute some code if the statement provided agrees with the condition.
- IF
1.A fragment of code that produces a value, expressions can contain other expressions within them.
2.Helps a program keep an internal state to catch and hold values, they do not contain values but more so grasp them for reference, two bindings can refer to the same value.
3.The collection of bindings and their values that exist at that given time within that program is called the environment.
4.A piece of program wrapped in a value, a lot of values in a default environment such as a web browser have the type function.
5.prompt(" enter your number");
alert(“good morning”);
6.Showing a dialog box or writing text to the screen is known as a side effect.
7.alert(" this a side effect");
console.log(math.max(2, 4));creates a value, in this case looks at the values and selects the largest number from the values available 4
8.When a program contains more than 1 statement, the statements are executed like a story so to speak, from top to bottom, this is known as the control flow.
9.If the program is not just straight forward and wants another route based on the situation, this is known as a conditional execution.
10. To invoke conditional executions “if” code is only executed if and only if the conditions are met or holds. “else” can also be used if creating 2 separate alternative executions.
What is an expression?
A fragment of code that produces a value is called an expression . Every value written literally is an expression, placed between quotes or parentheses.
What is a binding?
A binding (or variable) allows JavaScript to catch and hold values, within a program. A special keyword (let, var, const) indicates that a sentence is going to define a binding.
What is an environment?
An environment consists of a collection of bindings and their values.
What is a function?
A function is a piece of program wrapped within a value, when this value is applied it can help to run the program it is wrapped inside of.
Give an example of a function.
A banking pin #: To access your bank account at an ATM you must enter your pin code which is a function required to get to the program to open your banking details.
What is a side effect?
Showing a dialog box is a side effect . Writing text to the screen is another side effect .
Give an example of a function that produces a side effect and another function that produces a value.
Side effect: console.log(“Hello World, it is raining.”); --> Hello World, it is raining
Value: var a = 5 var b = 10 console.log(a + b); --> 15
What is control flow?
Control flow is a program with more than one statement, and these statements are executed as if they are in order, like a story.
What is conditional execution?
Conditional execution only executes code if a certain condition is met.
What kind of keyword do you need to use to invoke conditional execution?
In JavaScript conditional execution is created with the keyword “if”.
- What is an expression? A Fragment of code that produces a value.
- What is a binding? JavaScript provides bindings to catch and hold values.
- What is an environment? A 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. Alert (“Replying to assignment”)
- What is a side effect? 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 makes a side effect and Math.max produces a value.
- What is control flow? The order in which the computer executes statements in a script.
- What is conditional execution? A branch in the control flow’s execution, where JS picks a branch/road depending on the current conditions.
- What kind of keyword do you need to use to invoke conditional execution? if and else
- Expression is a fragment of code that produces a value.
- Bindings are used to catch/hold values (to remember things).
- Environment is a collection of bindings and their subsequent values that exist at a given time.
- Function is a piece of program wrapped in a value.
- prompt(“Enter name”); - a function that will show a dialog box asking for input.
- Side effect is e.g. a dialog box or writing text that is being shown on the screen.
- Side effect: prompt(“Enter password”). Value: console.log(Math.max (2,4)); // 4
- Control flow means that the statements are being executed from top to bottom (straight line).
- Conditional execution means that the program takes the proper ‘branch’ based on the situation at hand.
- The ‘if’ keyword.