- What is an expression?
• A unit of code that represents a value. This can be numbers, strings, Boolean expressions and more. - What is a binding?
• Binding is when a program hold a value so it can be used again. These are also called variables. In Javascript, the keywords “let,” “var,” and “const” indicate that a statement is going to define a binding. The equal sign (=) defines the value assigned to a variable and can also be used to change the value. - What is an environment?
• Collection of bindings and their values that exist at a given time
• JavaScript contains bindings that are a part of its language standard - What is a function?
• A piece of program wrapped in a value
• Can be applied in order to run a wrapped program
• A set of statements that performs a task or calculates a value - Give an example of a function.
• An example of a function can be a code written to only accept odd numbers and then prints an odd number to the console.
• Calculators perform many functions. - What is a side effect?
• any application state change that is observable outside the called function other than its return value
• Statements that perform some sort of change - 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 side effect is a function that only accepts odd number, and an “if statement” can be applied if there is an even number which outputs “this is not an odd number” to the console.
• One that produces a value is if the number is odd and is accepted. - What is control flow?
• Top to bottom execution
• Order in which statements are executed - What is conditional execution?
• Branching execution of a program based on situation
• 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
[quote=“ivan, post:1, topic:3069”]
- What is an expression? Any fragment of code that produces a value
- What is a binding? it is a second kind of statement. (keyword). the word let binds a chosen word to a value or string. A binding grabs a value.
- What is an environment? Collection of bindings and their values at a given time.
- What is a function? A piece of program wrapped in a value - like how a prompt causes a prompt box to display or execute
- Give an example of a function.
- What is a side effect? a result initiated due to a function
- Give an example of a function that produces a side effect and another function that produces a value. “prompt” causes the prompt box to display when executed
- What is control flow? when a program has greater than one statement - the flow of which the code is read - like top to bottom - left to right
- What is conditional execution? like a branching road - code that executes if and only if certain conditions are met - uses the function
- What kind of keyword do you need to use to invoke conditional execution? “if”
Binding, functions and control flow.
- What is an expression?
1- It is a fragment code that produces a value.
- What is a binding?
2- A binding “binds” (sorry for the internal accusative) a name to a value, so the name holds a value and it is connected to it.
- What is an environment?
3- It is the corpus of existing bindings and values at a given time.
- What is a function?
4- It is a piece of a program wrapped in a function.
- Give an example of a function.
5- console.log is a function.
- What is a side effect?
6- A side effect is an operation that affects or changes what cames after it.
- Give an example of a function that produces a side effect and another function that produces a value.
7- prompt(“Enter ID:”);
console.log(45+44);
- What is control flow?
8- It is the order in which the individual statement are to be executed or concatenated
- What is conditional execution?
9- A conditional execution happens when a program offers two (or more) branches, and the program takes the proper action based on the current situation.
- What kind of keyword do you need to use to invoke conditional execution?
10- The conditional, if .
- A fragment of code that produces a value is called an expression.
- Binding is used in JS to catch and hold values.
- A collection of bindings and its values that exist at a given time.
- A piece of program wrapped in a value.
- prompt(“Hello”);
- Showing a dialog box or writing text to the screen.
- console.log(Math.max(2,4)); -> produces a value
prompt(“Hello”) -> produces a side effect - The order in which the coding is executed.
- When we want to create a branching road and the program takes the proper branch based on the situation at hand.
- Keywords such as if, else
-
What is an expression?
A fragmented code that produces a Value. -
What is a binding?
Creating a new function that will call the original function but with some of the arguments already fixed. -
What is an environment?
The collection of variables 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.
alert(“Good Morning”); In a web environment, the variable “alert” its purpose is to provide box with a message. -
What is a side effect?
A Statement that stands on its own in which amounts to something only if it affects the world. It could display something on the screen that counts as changing the world or change the internal state of said machine in a way 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.
alert (" Good morning !") ;
var x = 30;
console . log (" the value of x is " , x ) ;
// → the value of x is 30
-
What is control flow?
When the statements are executed, predictably, from top to bottom -
What is conditional execution?
where we choose between two different routes based on a Boolean value. Conditional execution is written with the “if” keyword in JavaScript. In the simple case, we just 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?
keyword if.
- anything that produces a value is an expression
- binding holds a value that can be referred to / called out in a computation/calculation
- a collection of values and bindings
- function is a subprogram within the program and it’s designed to perform a particular task
- alert(“Hi”);
- the program 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.
- value = console.log(1+2);
side effect = prompt(“Enter a new value”) - control flow is direction of the code execution (top to bottom as default)
- conditional execution happens when the control flow is depending on a condition to be true or false (or a value to be smaller/greater/equal to a set amount). depending on the answer, the program will execute the rest of the code differently
- if and else
-
An expression is a fragment of code that produces a value.
-
Binding is used to produce and catch new values from old values.
-
An environment is the collection of bindings and their values that exist at a given time.
-
A function is a piece of program/an expression wrapped in a value. It can be executed by calling it.
-
Function example: alert(“Hello World”);
-
Side effect is showing a dialog box or writing text to the screen.
-
Side effect example: prompt(“Enter your name”); Value example: console.log(1 + 1);
-
Control flow is the direction of execution of statement in Javascript which happens from top to bottom.
-
Conditional execution is when the program takes the proper branch in the control flow’s execution based on the situation and conditions that are present.
-
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 thing provided by JavaScript that allows you to catch and hold values.
3 What is an environment? -An environment is the collection of bindings and their values that exist at a given time.
4.What is a function? -A function is a piece of program wrapped in a value.
5.Give an example of a function. -An example would be prompt('Enter Passcode")
6.What is a side effect? -A side effect is showing a dialog box or writing text to the screen.
7.Give an example of a function that produces a side effect and another function that produces a value. - let num = 0;
const func = () => {
num = 1;
return true;
}
func();
9.What is control flow? -A control flow is when your program contains more then one statement, the statements are executed as if they are a story, from top to bottom.
10.What is conditional execution? -A conditional execution is where the program takes the proper branch based on the situation at hand.
11.What kind of keyword do you need to use to invoke conditional execution? - The key words are if and else.
- What is an expression?
It is something that is written that creates a value. It is kind of like a sentence an expression can have expressions inside of expressions. It’s a fragment of code that creates a value. - What is a binding?
It is when you give something a value. Variables and constants are bindings. A constant is a variable for the life of the binding. For example let foxes = wolves, or let ten = ten, would be an example of a binding. However, when naming bindings, they cannot start with a digit. - What is an environment?
The environment is the culmination of all the current bindings in the program. - What is a function?
A function is a piece of a program wrapped in a value. - Give an example of a function.
function countitems(bread,milk,cheese,yogurt) {
return bread2+milk1.5+cheese4+yogurt1.2
} - What is a side effect?
A side effect is a statement that affects future statements. - Give an example of a function that produces a side effect and another function that produces a value.
A dialogue box or printing to the screen.
console.log(Math.max(3, 8));
// → 8 - What is control flow?
It’s how you write the program. It kind of means that you write it like a story from the beginning to the end. This would be in terms of the actions that you are asking the program to perform. - What is conditional execution?
Basically, if something happens that you want to have the program act on, yet it will not act on something unless the thing you want to happen does. Most often this would start with an “if” statement. An example would be allowing a string or a numeric value any only allowing one of these to drive how the program reacts. - What kind of keyword do you need to use to invoke conditional execution?
“if” and/or “else,” depending on what you are trying to do with conditional execution.
- a small pieces of code that produces a value
2.bindings are the same as varibables whit means they hold values
3.it is a collection of bindings and values the are present at any given time
4.a program thats wrapps around a value this values can be applied in order to run the program -
prompt("Enter Passcode");
6.showing the box that holds “enter Passcode” is ex a side effect it can also be a value
7a.console.log(Math.min(2, 4, 6));
7b. prompt(“how old are you?”)
8. the function number converts a value to a number ex. stings and booleans
9.when we want to take the proper branch of code due to different conditions meet with in the input
10.“let” “if” “else”
- An expression is a fragment of code that produces a value.
- Bindings let you grasp a value to use or remember later. let, var, const
- An environment is the collection of bindings and values that exist at a given time.
- A function is a piece of program wrapped in a value. Those are then applied to run the wrapped program.
- prompt(
Enter Passcode
); - A side effect can showing a dialog box or writing text or may be an unintentional change to the other statements in the program.
- Pulling up a dialog box is a side effect, and using the console as a calculator would be a function that produces a value.
- The control flow is how the statements are executed as if they were a story from top to bottom.
- The conditional execution is the branching (or straight) possible paths the code can execute.
- To invoke conditional execution you use the keywords: “if” and “else”.
-
What is an expression?
An expression is a fragment of code that produces a value -
What is a binding?
A binding is the aspect that holds or remembers a value for example let, const or var -
What is an environment?
The collection of bindings with their given 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.
For example console.log holds the function to print the value inserted by the programmer -
What is a side effect?
Showing a dialogue 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 function → prompt
Value function → sum -
What is control flow?
The order how the instructions or functions are executed. For example from beginning to the end of the line. -
What is conditional execution?
If the program is executed in a branched road based on the situation at hand. -
What kind of keyword do you need to use to invoke conditional execution?
if
- What is an expression? a fragment of code that produces a value
- What is a binding? an expression that defines a value
- 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. Console.log
- What is a side effect? the action of a function
- Give an example of a function that produces a side effect and another function that produces a value. Let sets value inside of a function and a diaglog box would be a side effect
- What is control flow? it sets the precedence on what action will be processed first, second and so forth
- What is conditional execution? it creates and exception or sets a standard to a specific rule or variable
- What kind of keyword do you need to use to invoke conditional execution? let
-
What is an expression?
a fragment of code that produces a value -
What is a binding?
a binding or variable is used to catch and hold values in javascript -
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.
prompt(“Enter name”); -
What is a side effect?
something that happens that you can interact with when you run a function -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Enter name”);
console.log(Math.max(2,4));
-
What is control flow?
If 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?
a non linear program where the program can take different branches depending on the situation at hand. -
What kind of keyword do you need to use to invoke conditional execution?
if, else if, else
-
A fragment of code that produces a value.
-
Bindings catching and holding 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.
-
prompt(“Enter number!”);
-
Showing a dialog box or writing text to the screen is a side effect.
-
prompt(“Enter random number”) produces a side effect, console.log(1+1); will produce a value
-
When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
-
Conditional Execution follows a branch, depending on the value.
-
if
-
What is an expression?
Multiple parts of a code can be an expression, it is a value, it can be operators, variable, and is needed to get an answer. -
What is a binding?
It is used to attach info to expressions/objects. -
What is an environment?
Where all the code is, all the bindings that function in an area and certain time. -
What is a function?
Code that needs to perform something specific. -
Give an example of a function.
var a = 1; var b = 2; console.log (a+b); -
What is a side effect?
A function that affects the value. -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“how are you”); - produces a side affect
console.log(a+b); = produces a value -
What is control flow?
In what order the program executes the code. -
What is conditional execution?
Pieces of code will be executed if they meet the condition that Is needed. -
What kind of keyword do you need to use to invoke conditional execution?
If, while, &&
- A fragment of code with produce a value
- A binding is a virtual string with which a value is attached to a reference (either chosen by the developer of given in the protocol)
- The environment is the set of binding and side effects pre established to a statement
- A Function is a program attached to value which is applied when called.
- Math.max
- A side effect happens when the execution of a script has potential effect on following statements
- side effect: var value: math.min
- control flow are the one or different branches a program can take to return a value or side effect.
- conditional execution is when a program is executed depending on the “true” result of boolean functions
- if
- expression is a fragment of code that produces a value
- binding is pointing to some value if we want this value to be stored. As long as we have this “reference”> program can use the value, when we are creating new reference, old one is not active any more.
- collection of bindings and their values that exist at a given time
- function is a piece of program which represents some value
- function “alert” that creates a dialog window on a webpage with some information which user put into a function.
- side effects is a changes of internal state of a program, in a statement that comes after an expression, changes on the screen that expression produces
- function “prompt” has a side effect in a way that it creates a dialog window on the screen.
let number = Number(prompt("give any number)) // produces a value from number that we put into that window. - control flow is the way program execute statements (from top to bottom)
- conditional execution means the ways we’re define the program to execute different statements depends on condition we defined by special commands
- If
-
What is an expression?
A fragment of code, every value that os written is an expression, for example: 3; !true; -
What is a binding?
Also know as “let” and “var” in the javascript.
Its means that you define a sentence thrue binding,
its fallowed by the name of the binding and if i want, i can give it a value, by an = operator and expression. -
What is an environment?
The collection of bindings and their values that exist at a given time is called
the environment.
Its means when you start a program, it always contains bindings that ar part of the language standard.
-
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. like the “prompt” function -
Give an example of a function.
Alert, prompt. -
What is a side effect?
Showing a dialog box or writing text ti the screen is a side effect. -
Give an example of a function that produces a side effect and another function that produces a value
prompt (“hello”)
and
console.log(Math.max (10, 30))
// 10 -
What is control flow?
When your program contains more than one statement, 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. -
What kind of keyword do you need to use to invoke conditional execution?
if or else
- A fragment of code that produces a value.
- They are elements to catch and hold 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. Such values can be applied
in order to run the wrapped program. - alert(“Hey Ivan, $34,000!”);
- A side effect is an observable change caused by a function. Showing a dialog box or writing text to the screen is a side effect.
- prompt(“Tell me a word”); is an example of function that produces a side effect.
console.log(Math.max(5, 10)); is an example of function that produces a value. - It is the order in which the instructions are executed within the program.
- Conditional execution is when, thanks to certain keywords, you condition the program according to the value you have at that moment.
- if and else.