1.It’s a fragment of code that produces a value.
2.It catches and holds values.
3.A collection of bindings and their values that exist at a given time
4.A piece of program wrapped in a value.
5 alert(“Smash those likes!”);
6.Showing a dialog box or writing text to the screen.
7.prompt(“press any key.”); console.log(5 + 5);
8.The direction a code will be executed,from top to bottom.
9.It helps you to design workflows that can execute commands when specified conditions are met.
10.if or you can use the else keyword together with if
I might have deleted my previous post so here it is again just in case.
1.It’s a fragment of code that produces a value.
2.It catches and holds values.
3.A collection of bindings and their values that exist at a given time
4.A piece of program wrapped in a value.
5 alert(“Smash those likes!”);
6.Showing a dialog box or writing text to the screen.
7.prompt(“press any key.”); console.log(5 + 5);
8.The direction a code will be executed,from top to bottom.
9.It helps you to design workflows that can execute commands when specified conditions are met.
10.if or you can use the else keyword together with if
- A fragment or part of a code that produces a value.
- A binding is another word for ‘variable’. It stores a value.
- An environment is a collection of bindings/variables and their values.
- A function is a piece of program wrapped in a value, which can be applied to run the wrapped program.
- alert(“hello world”)
- A side effect is produced when a function is called, such as a dialog box popping up when using the ‘alert’ function.
- The ‘prompt’ function produces a side effect and the console.log function produces a value.
- The control flow is the way statements are executed when a program has more than one statement.
- Where a program is executed based on the situation at hand. Usually starts with an ‘if’ statement.
- ‘If’, ‘else’ or ‘else if’
- What is an expression?
- A fragment of code that produces a value. Every value that is written is a expression.
- What is a binding?
- It is what Is used to “catch and hold” a value
- 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 programing wrapped in a value.
- Give an example of a function.
- Prompt(“Enter Name Here”);
- What is a side effect?
- “Return” values that affect things in programs are a side effects, i.e. displaying something on our screen.
- Give an example of a function that produces a side effect and another function that produces a value.
- Prompt or log are examples of functions which result in side effect.
- Math.min/Math.max functions will produce values.
- What is control flow?
- If a program contains more than one statement, they are executed as if they are a story, from top to bottom. In a straight line.
- What is conditional execution?
- A program will take/choose a path based on a situation.
- What kind of keyword do you need to use to invoke conditional execution?
- if and else
-
What is an expression?
A fragment of code; any value is written literally. -
What is a binding?
A variable. It is a way to catch and hold values. -
What is an environment?
The collection of bindings and their values that exist at any given time. -
What is a function?
A function is a piece of program wrapped in a value. It is usually put in parenthesis. Values given to functions are called arguments. -
Give an example of a function.
prompt(“Enter Passcode”); -
What is a side effect?
A side effect is are the affects or changes to something in the world, whether that is a display on the screen or the changing of the internal state of a machine. -
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 console.log() because it displays an output to the console, where as a value function such as Math.max, will take any number argument and gives the greatest. -
What is control flow?
The way which a program functions when it contains two or more statements, usually going from top to bottom. -
What is conditional execution?
In Javascript it is used with the if keyword, which allows code to be executed only if it meets a certain function that is held. -
What kind of keyword do you need to use to invoke conditional execution?
The if keyword is used.
- A fragment of code that produces a value
- is a function to hold old values
- the collection of bindings and their values
- a piece of program wrapped in a value
- consol.log
- writing text to the screen or showing o dialog box
- value: Math.max
side effect: prompt - When your program contains more than one statement, the statements are executed as if they are a story and this is control flow
- when a program takes the proper branch based on the situation at hand
- if
-
An expression is a command that gives something value.
-
A binding is the attachment of a value to a string.
-
An environment is the collection of the program’s bindings and values.
-
A function is a program wrapped in a value.
-
console.log
-
A side effect happens when an expression or function changes the value of a variable in the program.
-
prompt(“Enter passcode”); <- this produces a box that is visible outside the console
console.log(2+4); <- produces a value with no binding that is only visible in the console. -
Control flow is the order in which expressions and functions are executed.
-
A conditional execution is when a function runs only when certain conditions are met. This is achieved with the if keyword.
-
If, else, while
- What is an expression?
a piece of the code that holds value - What is a binding?
a binding ties information, you can have several bindings to the same information - What is an environment?
all the bindings and their values that exists in your code at that time - What is a function?
a piece of code that can do a programmed task when you call it with its value(name) - Give an example of a function.
prompt(“write your name”); creates a popup that requests you to state your name. - What is a side effect?
its when a statement affects all the statements that comes after it. - Give an example of a function that produces a side effect and another function that produces a value.
-Confirm function
-Math.max - What is control flow?
how the code in the program is red and executed, left to right-top to bottom if not stated otherwise. - What is conditional execution?
depending on the information feeded to a boolean, the program continues in one of several routes thats connected to values. - What kind of keyword do you need to use to invoke conditional execution?
“if”
- What is an expression?
- An expression is a piece of code that generates a value.
- What is a binding?
- Otherwise known as a variable, bindings pieces of code that grasp on to values. That value may change depending on the expression affiliated with the binding.
-
What is an environment?
The environment is the collection of bindings and values that exist in memory at a given time. -
What is a function?
A function is a program wrapped within a value. -
Give an example of a function.
prompt(“enter zip code”) -
What is a side effect?
side effects are returned values that are generated from functions. -
Give an example of a function that produces a side effect and another function that produces a value.
console.log(2+2);
4 -
What is control flow?
It’s the order in which code processes. -
What is conditional execution?
Conditional executions are parts of code that are only executed if certain conditions are fufilled. -
What kind of keyword do you need to use to invoke conditional execution?
conditional expressions such as “IF”
-
What is an expression?
A piece of code that when resolved produces a value. -
What is a binding?
Where JavaScript assigns a specified variable and references it to a value. -
What is an environment?
The collection of variables within a program and their binding values at a given time. -
What is a function?
A piece of code created to carry out a specific task of calculating an output result based on whatever the inputs are. -
Give an example of a function.
function TAKEAWAY(y, z) {
return y - z;
}
undefined
TAKEAWAY(25,9)
16 -
What is a side effect?
Where a function/expression can affect subsequent program statements that are beyond the scope of the value returned by the function/expression. -
Give an example of a function that produces a side effect and another function that produces a value.
Side effect – returns no value
var z = 8
function subtractFive(){
z = z - 5;
}
subtractFive()
undefined
Function returns a Value
function takeFive(){
var z = 8;
function subtractFive(){
z = z - 5;
console.log(z)
}
subtractFive();
}
takeFive()
3
undefined
-
What is control flow?
Where there are two or more statements in a piece of code which are executed in sequence from top to bottom. -
What is conditional execution?
If a certain condition is met, only then will a particular piece of code be executed. -
What kind of keyword do you need to use to invoke conditional execution?
if, else, else if
- Any unit of code that can be evaluated to a value** is an expression.
- recording that identifier in a specific Environment Record.
- The data structure that provides that storage space.
- a set of statements that performs a task or calculates a value.
5.function myFunction(p1, p2) {
return p1 * p2; - any secondary effect or reaction that comes from an action we take.
7.console.log produces side effect and Math.max produces a value. - the order in which the computer executes statements in a script.
- perform different computations or actions depending on whether a programmer-defined boolean condition evaluates to true or false.
- if
-
An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value.
-
A Binding is something that catches and holds a value. After it was defined, it can be used as an expression.
-
The Browser.
-
A block of code designed to perform a particular task.
-
prompt(“Enter Password”);
-
Something that counts as “changing the world” ( showing something on the screen, or changing the internal state of a machine in a way that it will change the statements that come after it.
-
console.log(“Hello World!”);
console.log(5*5); -
The control flow is the order in wich a computer executes statements in a script.
-
Conditional execution means that specific conditions have to be held in order to execute a specific line of code.
-
The keyword if
-
An expression is a fragment of code that contains a value
-
A binding is a thing that allows a program to catch and hold values
-
An environment is the collection of bindings and their environment that exist at a given time
-
A function is a set of instructions that perform a specific task a user wants to implement in their program to achieve a single desired outcome
-
The function add number
-
A function that will change the font of a a string value (side-effect) and a function that adds up two numeric values
-
It is the order in which the statements are being executed
-
The decision the program will take is based on the situation
-
the “if” keyword
- An expression is a fragment of code that produces a value.
- A binding is a defined variable that allows one to produce a value when that binding or variable is called.
- An environment is a collection of the bindings and their values at a given point in time.
- A function is a piece of program wrapped in a value.
- An example of a function is “console.log” function. This function is used to print any kind of variables that have been defined before it.
- A side effect is a statement that could change the internal state of the machine that could affect the statements that come after it.
- Showing text to a screen using a function such as “console.log” is a side effect. The function “Math.max” returns a value.
- A control flow is when there are a number of statements in a program and then are sequenced in a certain manner.
- A conditional execution is where there are condition paths or conditional sequences of statements that get executed based on a certain condition being met. In other words, it is a control flow that can take different paths based on the conditions defined in statements.
- The keyword “if” is used to invoke a conditional execution.
1. What is an expression?
It’s a fragment of code that produces a value. Every value that is written literally is an expression.
2. What is a binding?
A binding allows a program to keep an internal state by remembering values. To catch and hold values, JavaScript provides a thing called binding, or 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. 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.
3. What is an environment?
It’s the collection of bindings and their values that exist at a given time. When a program starts up, the 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.
4. What is a function?
A function is a piece of program wrapped in a value. Such values can be applied in order to run the wrapped program. Executing a function is called invoking , calling or applying it.
5. Give an example of a function.
The console.log function is used by JavaScript systems including all modern web browsers to write out its arguments to some text output device.
The prompt function isn’t used much in modern web programming, mostly because you have no control over the way the resulting dialog box looks.
6. What is a side effect?
A side effect is using a function for example to show a dialog box or writing text to the screen. 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.
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”);
Functions may also produce values, in which case they don’t need to have a side effect to be useful. The function Math.max takes any amount of number arguments and gives back the greatest. When a function produces a value, it is said to return that value. It is used like this.
console.log(Math.max(2,4));
// 4
8. What is control flow?
Its when your program contains more than one statement and the statements are executed as if they are a story from top to bottom
9. What is conditional execution?
Conditional execution is where not all programs are a straight road. For instance, you may want to create a branching road where the program takes the proper branch based on the situation at hand.
10. What kind of keyword do you need to use to invoke conditional execution?
Conditional execution is created with the if keyword in JavaScript. For example, we want some code to be executed if , and only if , a certain condition holds. The if keyword executes or skips a statement depending on the value of a Boolean expression.
-
What is an expression?
–> “A fragment of code that produces a value…” -
What is a binding?
–> A variable used “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. Such values can be applied in order to run the wrapped program.” -
Give an example of a function.
–> “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”);” -
What is a side effect?
–> result of a statement that modifies the internal state of a machine outside the scope of the statement. -
Give an example of a function that produces a side effect and another function that produces a value.
–> Side Effect example: alert(“Do not forget to type your name”)
–> Value example: let caught = 5 * 5; -
What is control flow?
–> “When the program contains more than one statement, the statements are executed as if they are a story, from top to bottom.” -
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”. -
What kind of keyword do you need to use to invoke conditional execution?
–> “if”.
- What is an expression?
Anything that produces value is an expression in JS - What is a binding?
A binding catches and holds values like tentacles, rather than boxes. They do not contain values they grasp them two bindings can refer to the same value. - What is an environment?
An environment is the collections of bindings and their values that exist at a given time. It always contains bindings that are part of the language standard, and most of the time is also has bindings that provide ways to interact with the surrounding system. - What is a function?
A function is a piece of program wrapped in a value. You can
call a function by putting parentheses after an expression that produces a
function value. - Give an example of a function.
prompt(“enter password”); - What is a side effect?
A statement stands on
its own, so it 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.
alert(“hello”);
console.log(2+2); - 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?
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
Answers:
-
Values and opertators as a whole is called expression. Also a code which creates value is called expression.
-
Bindings are like tentacles, you connect them with other value, they remember things catch and holds it.
-
As a whole is called enviroment. All the bindings etc.
-
Is a piece of program wrapped in a value.
5.For example: prompt or alert etc.
-
A side effect is the result, when a function creates something, like: alert or giving a box to write
-
Side effect: alert (“Hello World”), function that produces value: console.log(5+5) = 10
-
control flow means that direction which the program runs, so from left to right and top to bottom
-
So with this one, you can give different answers in which case you will also receive different answers, basically you can have different execution paths,
-
This with if and else.
Question: I don’t get it with the console: So when you write: 5+5 you will receive 10. If you write: console.log(5+5) you will also have 10 as a result. So why should I write console.log?
Thank you
- What is an expression?
Any fragment of code that results in a value - What is a binding?
A binding is a value caught and held such as stored in a variable. - What is an environment?
An environment is a collection of bindings (variables and their values) in a given instance - What is a function?
A function is a bit of code that may or may not return values or manipulate bindings that can be invoked or called upon elsewhere. - Give an example of a function.
function theUltimateFunction(e) {
if (e="I love myself") {
return true;
}
else return false;
}
- What is a side effect?
the effect when a function is called and it changes a variable outside of the function itself. - Give an example of a function that produces a side effect and another function that produces a value.
The example I gave above is a function that produces a value, this one produces a side effect
let i ="awesome";
function the2ndUltimateFunction(e) {
if (e=="I love myself") {
alert(e);
i += ", you know you are ";
return true;
}
else {
i = "You don't know how " + i + " you are!";
return false;
};
};
- What is control flow?
The order of execution in a program - top to bottom and looped, if else’d, switched, function called and so on! - What is conditional execution?
A logical operator which determines what code to execute or what not to execute. - What kind of keyword do you need to use to invoke conditional execution?
if, else, case, switch, while, for
- What is an expression?
A fragment of code that produces a value.
- What is a binding?
A binding, or variable, allows JavaScript to hold values.
- What is an environment?
Is the collection of bindings and their values.
- What is a function?
A function is a piece of program that is wrapped in a value.
- Give an example of a function.
prompt(“Enter passcode”);
- What is a side effect?
Writing text to the screen 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(Math.max(2, 4)); // → 4
- What is control flow?
When a program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
- What is conditional execution?
In this type of program a condition execution is created by using the word “if” and values which allows the program t take the proper path based on the values presented.
- What kind of keyword do you need to use to invoke conditional execution?
The keyword “if”.