1-> An Expression is a fragment of code that produces a value
2-> A Binding is a thing that provides catch and hold a given value
3-> The collection of bindings and their values that exist at a given time is called
the environment
4-> A function is a piece of program wrapped in a value
5-> console.log is a example of a function
6-> Showing a dialog box or writing text to the screen is a side effect,
7-> So than the console.log or the alert function produces a side effect, that being said the prompt holds a function to show a dialoog box so in my opinion that is also a side effect. The function Math.max or Math.min is a function that gives a value as example
8-> Controlling the conditional execution flow
9-> 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.
10-> the “ïf” keyword
-
A fragment of code that produces a value.
-
A statement indicated through keywords as “let”, "var"or “cons”. A way the program keeps an internal state, how to remember it, to re-use it later.
-
Values and Bindings that exist already at a given time in the browser for expl.
-
A piece of program wrapped in a value.
-
console.log(Math.min(2,4,9)+400));
-
Showing someting to the outside world. Like a dialog box.
-
Dialog box side effect prompt(“Enter passcode”);
Value producing console.log(Math.max(7,8,4))); -
How the statements are executed (from top to bottom, straight-line control flow)
-
Only if a certain condition is valued true it is going to be executed. The creation of a branch road… th eprogram takes the proper way based on the situation at hand.
-
"If" and "else"
-
What is an expression?
An expression is a set of values and operators. -
What is a binding?
A binding attaches a value to a label. -
What is an environment?
The JS environment is the program that runs JS code. -
What is a function?
A function is a program with binding to a label. -
Give an example of a function.
Math.abs(x); -
What is a side effect?
A side effect is a change observable or accessible outside of the scope of a function. -
Give an example of a function that produces a side effect and another function that produces a value.
var sr = Math.sqrt(square); // side effect
Math.sqrt(25); // value -
What is control flow?
The execution order of program statements. -
What is conditional execution?
Conditional execution executes only if a specified condition is met. -
What kind of keyword do you need to use to invoke conditional execution?
If, Else, While, are some conditional execution keyword examples.
- What is an expression?
-A fragment of code that produces a value is called an expression. - What is a binding?
-A binding is a synonym with “variable”. It is simply the creation of a variable. - What is an environment?
-The collection of bindings (variables) and their values that exist at any time in your program is called the environment. - What is a function?
-A function is a stand-alone piece of code that can be executed to produce a value. For example, the function “prompt” in JavaScript can be executed to prompt the user for input. - Give an example of a function.
-prompt(“Enter your password:”); creates a dialog box that waits for the user to enter their password. - What is a side effect?
-Presenting 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(“This is a side effect.”);
-Value: Math.max(3,5); - What is control flow?
-It is logic that controls what lines of code get executed. Without intervening logic, the code gets executed from top to bottom. - What is conditional execution?
-Conditional execution is logic that checks for the truth of a certain condition and only executes the subsequent statements if the condition holds true. - What kind of keyword do you need to use to invoke conditional execution?
-If, While, Do…While, For, Switch…Case
-
An expression is a fragment of code that produces a value.
-
A binding is a variable that is used to remember (catch and hold) values.
-
An environment is a collection of bindings and their values.
-
A function is a piece of program that performs a given task.
-
An example function:
prompt("Enter a value for x");
-
A side effect is a consequence that takes place outside the environment of the program, usually as a result of a function execution. For example, showing a dialog box or writing text to the screen.
-
A function with a side effect:
prompt("Enter a value for integers a and b);
A function that produces a value:console.log(a+b)
-
Control flow is the order of code execution.
-
Conditional execution is when code is executed depending on certain requirements (conditions) stated in the code.
-
Conditional execution involves
if
,else
andelseif
conditions in code execution. For example:
var x = prompt("Enter a value for x");
if(x%2=0){
console.log(x^2)
}
elseif(x%2=1){
console.log((x+1)^2)
}
else{
console.log("You didn't enter an integer!")
}
-
What is an expression?
An expression is an input of a value or string. -
What is a binding?
A binding is a memory, assigning value and defining an expression. -
What is an environment?
The environment is the set of bindings which exist in a code at a given time. -
What is a function?
A function is a program itself, which interacts with a value it is given. -
Give an example of a function.
The common console.log() command is a function which tells the console to output the results of data which is provided. -
What is a side effect?
Side effects are the visual or interactive output on the page created by the function. -
Give an example of a function that produces a side effect and another function that produces a value.
- The function alert(“hi”); will have the side effect of creating a popup box on the screen which says “hi”.
- The function console.log(1+2); will instead output the value 3 in the console window.
-
What is control flow?
Control flow is the orientation of a program, as to select the order by which lines are read, and operations are carried out. The flow reads from top of page to bottom. -
What is conditional execution?
Conditional execution refers to the course a program takes depending on the inputs it receives. -
What kind of keyword do you need to use to invoke conditional execution?
- “if” input is true then function yields output
- “else” apply input to separate function, or yield alternative output.
- A fragment of code that produces a value.
- A binding catches and holds values.
- A collection of bindings and their values that exist at a given time.
- A piece of program wrapped in a value.
- prompt(“Enter number between 1 and 10”)
- showing a dialog box or writing text to the screen
- console.log(Math.min(8, 15));
- When your program contains more than statement and is executed like a story
- Program that is executed based on situation at hand
- if
-
What is an expression?
an expression is anything that can be expressed by a value. expression can be inside one another. -
What is a binding?
Binding is linking old values to create a new value ex.: var x = a + b… now x means a+b until you equal it to something else -
What is an environment?
Environment is in a way , what do values mean at a certain point in time. when you are starting a program the only binds are what comes standard in the programming language. -
What is a function?
A function is a piece of program wrapped in a value -
Give an example of a function.
displayName can be a function that displays a your name like function displayName() {console.log(“Dean”)};… Now displayName is wrapping console.log(“Dean”)… console.log(“Dean”) is also a function -
What is a side effect?
Is something that changes or affects the statements that come after. -
Give an example of a function that produces a side effect and another function that produces a value.
side effect: var x = 10
value producing function: console.log(x) -
What is control flow?
It is the order in which the commands are executed which is top to bottom. -
What is conditional execution?
It is only executing a command if condition is met -
What kind of keyword do you need to use to invoke conditional execution?
if for 1, if else for 2 if else-if else for 3 etc…
-
What is an expression?
A piece of code that can be evaluated. E.g. 2 + 2 * 3 or console.log(“Hello”) -
What is a binding?
Bindings aka variables can be used to store values so that they can be reused and manipulated in the program. -
What is an environment?
The collection of all bindings and their values at a given time. -
What is a function?
A function is a piece of code that performs some action when it’s called. It often (but not necessarily) takes some input and produces some output based on that input. A function is also a value. -
Give an example of a function.
A function that adds two numbers together with some simple error checking:
function sum(a, b);
{
if(isNaN(a) || isNaN(b))
{
return “Error: Requires argument type: number”
}
return a + b;
} -
What is a side effect?
Something observable that happens when a function is called that isn’t it’s main function i.e. returning a value. For example, a side effect would be performing some I/O function (e.g. prompt()) or changing a global variable. -
Give an example of a function that produces a side effect and another function that produces a value.
Function that produces a value: math.min()
Function that produces a side effect: alert() -
What is control flow?
The order and direction in which a program is read and excuted. This is usually top to bottom. -
What is conditional execution?
When code is executed only when a certain condition is met. -
What kind of keyword do you need to use to invoke conditional execution?
if / else
1.a fragment of code that produces a value is an expression
-
Giving a name to something we cal call on later
-
The collection of bindings & values that exist is called the environment
-
A functions is a request for computation or a request for an output
-
Console.log is a function
-
A visual representation of an outputted function ?
-
Console.log(math.max(2, 4) *100;
-
Control flow is the top to bottom nature of how the JS is interpreted.
-
Its like a branching path that will take the correct route depending on the instructions given
-
IF or ELSE
- Any fragment of code that produces a value
- an action that lets he computer catch or hold a value
- the collection of bindings and their values at a given time
- a piece of program wrapped in a value
- window.prompt()
- showing a dialogue box or typing text to the screen
- window.prompt() produces a side effect and math.min produces a value
- the order in which we code
- where the program takes a branching path based on the situation
- if
- What is an expression?
A fragment of code that produces a value is called expression. ie: “James” or (2+2) - What is a binding?
Binding is used to hold a value until changed ie: var, const and let - What is an environment?
The collection of binding and their values that exist at a given time. - What is a function?
Program wrapped in a value. - Give an example of a function.
prompt - What is a side effect?
When you show a dialog box or write 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(prompt(“Enter Name”));
value function: console.log(Math.max(2, 4)); - What is control flow?
Path taken to reach and end value - What is conditional execution?
Used when multiple branches in program exist. - What kind of keyword do you need to use to invoke conditional execution?
if and else
- An expression is a fragment of code that produces a value.
- Binding allows the program to catch and hold values/
3.Environment is a collection of values that exist in a given time.
4.Function is a piece of program wrapped in a value. - Prompt(“Enter Password”).
6.A side effect is any application change of state that’s observable others than a return value.
for example : writing a message to the screen or triggering any external process.
7.document.write(“Side effect of this function”).
8.Control flow is the order in which each statement is executed.
9.Conditional execution is the “path” a program will execute a certain statement based on the situation at hand. - if or else.
-
An expression is a fragment of code that produces a value
-
A binding is Javascript’s way of catching and holding values
-
The 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. These function can be native Javascript functions or created by the programmer
-
prompt() is a function. It receives its argument inside the parentheses, which are the text shown to the user in the prompt dialog box
-
The side effect is the result a function produces, given its arguments
-
prompt(“What is your name?”) produces a side effect that is a dialog box asking that question; the function Math.max() returns the value of the greatest number among its arguments, thus producing a value
-
The control flow is the order in which the computer executes statements in a program
-
Conditional execution is the way by which a program decides whether to execute certain statements or not, based on some conditions defined by the programmer
-
The “if” and “else” keywords
- A Java expression consists of variables, operators, literals, and method calls.
- A Binding borrows a method of an object without making a copy of that method.
- The JavaScript runtime environment provides your scripts with utility libraries which can be used during execution.
- A function in JavaScript is a set of statements that performs a task or calculates a value, and return an output.
- function exampleFunction(ar){return Math.min(ar);} exampleFunction([5,9,6,7,3])
- A a side effect to anything that compromises the purity of a function.
- alert(); function afterTax(productPrice) { return (productPrice * 0.80) + productPrice;}
- Control flow is the order in which the computer executes statements in a script.
- Conditional execution is used to decide the flow of execution based on different conditions.
- if, else if, else
1. What is an expression?
Code that evaluates to a value.
2. What is a binding?
Allows an object to borrow a method from another object without making a copy of that method.
3. What is an environment?
Libraries and default objects available to you.
4. What is a function?
Set of statements that performs a task.
5. Give an example of a function.
function greet(name, lastName) {
console.log(‘Hello ‘ + name + ‘ ‘ + lastName)
}
greet(‘John’, ‘Smith’);
6. What is a side effect?
Alteration of outside scope.
7. Give an example of a function that produces a side effect and another function that produces a value.
Function that produces a side effect
let x = 0;
const increment = () => {
x = x + 1;
return x;
}
Function that produces a value
const increment = (x) => {
x = x + 1;
return x;
}
8. What is control flow?
Change behavior based on data. ie if, while loops.
9. What is conditional execution?
Controls whether or not the core will execute an instruction.
10. What kind of keyword do you need to use to invoke conditional execution?
If, else, else if.
1.- An expression is fragment of a code that produces a value.
2.- A binding is how the code retains a value; it can also be called variable.
3.- An environment is the collection of bindings and their values that exist at a given time.
4.- A function is a collection of code that takes input values and returns a computed value.
5.- An example of a function:
function savingsComp_funct(money, APy) {
Return money * (1+ APy);
}
6.- A side effect in programming is the changes caused or effects of the execution of a programming statement. Printing something into the console or a prompt alert are examples of side effects.
7.- Example functions:
7a - gives a Side Effect. Prints a string to screen.
function myfunct(str1) {
return console.log(str1);}
7b gives a value (boolean)
function myfunct_2 (val1, val2) {
return val1 > val2; }
-
A control flow is an operation in programming that allows repetitive commands until a condition is met.
-
Conditional execution is an operation in programming that allows the code to decide what to do according to a statement or condition predefined in the code.
-
In Javascript the keyword for conditional execution is if
-
What is an expression?
Any code that resolves to a value. -
What is a binding?
A binding is a variable = a piece of computer memory with some information inside. -
What is an environment?
Any set of of variables + values in memory at a given time.
-
What is a function?
A section of a program that performs certain task(s).
-
Give an example of a function.
let number = 0;
while (number <= 12) {
console.log(number);
number = number + 2; -
What is a side effect?
When a function modifies the state of something else it produces a side effect.
-
Give an example of a function that produces a side effect and another function that produces a value.
let number = 0;
const func = () => {
num = 1;
return true;
} -
What is control flow?
The order of the code and of the statements.
-
What is conditional execution?
if , if else, while, loop, true or false.
-
What kind of keyword do you need to use to invoke conditional execution?
- if, else.
- What is an expression? A fragment of code that produces a value (an expression).
- What is a binding? A binding is a variable that is connected to a value by an operator (=). Imagine ‘bindings’ as tentacles connecting variables to value.
- What is an environment? The collection of bindings and their values that exists at any given time is called the ‘environment.’
- What is a function? A function is a piece of program wrapped in a vlaaue.
- Give an example of a function. console.log()
- What is a side effect? Most functions are used because of the side effects they produce. A prompt window or a dialogue box is an example of a side effect.
- Give an example of a function that produces a side effect and another function that produces a value. Side Effect- prompt(); which produces a dialogue window. Value- Math.max() is an example of a function that produces a value.
- What is control flow? Is how a program is executed (like a story) top to bottom.
- What is conditional execution? The conditional execution is where the rogram takes the proper branch in execution.
- What kind of keyword do you need to use to invoke conditional execution? If is the conditional key word. Where we want a line of code to be executed if and only of a condition is met.
1 An expression is a fragment of code that produces a value
2 Binding is used to cath and hold values
3 The collection of bindings and their valeus at a certain moment
4 a function is a piece of program wrapped in a value
5 prompt is an example of a function producing a dialog box
6 a side effect is a change in the state of an application other than the returned value
7 function with side effect: Alert, calling a dialog box,
function producing a value: math.max returns the greatest out of a group of values
8 control flow: means that in general the instructions are being read from the top to the bottom.
9 conditional execution: not all programs are straightforward with built in conditions the program can take the correct direction or branches of the program
10 if