-
What is an expression?
A fragment of code that produces a value -
What is a binding?
A binding ties a value to an input (variable), allowing the program to “remember” fragments of its internal state -
What is an environment?
An environment describes the state of all the bindings and their values as a collective, at a given point in time -
What is a function?
A named piece of a program performing a pre-defined operation. -
Give an example of a function.
Let getUsername = prompt(“Enter your username”);
Console.log(getUsername); -
What is a side effect?
Any effect other than the return value, such as a pop-up box requesting information from a user upon the use of the prompt function. -
Give an example of a function that produces a side effect and another function that produces a value.
Side effect: alert(“Hello, World!”);
Value: console.log(5+7); -
What is control flow?
Control flow describes the “direction” in which the lines of code i.e. the statements of a program are executed. This is usually a top-down process, known as “straight-line control flow”. -
What is conditional execution?
Conditional execution directs the control flow according to conditions in the statements. For example, the if and else keywords can be employed to determine according to the size of a number a user has entered into a prompt function – one could direct the control flow by defining different “paths” for numbers smaller than 10, between 10 and 100, and larger than 100. -
What kind of keyword do you need to use to invoke conditional execution?
The keyword “if”
What is an expression?
A fragment of code that produces a value (so many things..)
What is a binding?
They 'link' a key->value pair
let name = "Fred"
name = "John' // Changes name to link or point to John.
What is an environment?
The 'bindings' and their 'values' that exist at a given time.
All the variables that are set at a given time..
- that could include the codes settings, but also system and user input settings.
What is a function?
Function is 'a piece of the program wrapped in a value'
I prefer:
A function is a section of organized, reusable code that is used to perform a action or set of actions.
Give an example of a function.
prompt("hello"); // prompt is a function pre-defined that does a pop-up with the word 'hello' (which we input)
// and then prompts a user for a response/input.
Or for example:
function deposit(address _mine, uint _amount) public payable {
.. work done here to track balances and check for errors to deposit tokens.
}
// and is called by and inputs the address and the value/amount.
deposit(msg.sender, msg.value);
What is a side effect?
"Showing a dialog box or writing text to the screen is a side effect."
* Meaning it may have a primary function of 'doing the math' but also displays the output.
Give an example of a function that produces a side effect and another function that produces a value.
// This returns a value and prints to the screen
console.log(4 + 5);
> 9
// This returns a value but does not print to the screen
The Multiply function does not produce output to screen but assigns to a variable
<script>
function multiply(a, b) {
c = a * b;
return c;
}
z = multiply(4,5);
console.log(z);
</script>
What is control flow?
Program or functions statements are executed in order.
What is conditional execution?
Part of the code is only run/executed if the condition is met..
What kind of keyword do you need to use to invoke conditional execution?
if, while, switch-case statement
switch (expression) {
case condition 1: statement(s)
break;
....
}
1. What is an expression? A fragment of code that produces a value.
2. What is a binding? Bindings are like tentacles they grasp values instead of containing them in a box.
3. What is an environment? A 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. A console.log
6. What is a side effect? Showing a dialog box or writing text to the screen is a side effect.
7. Give an example of a function that produces a side effect and another function that produces a value. Writing text to a screen is a side effect. Math.max is a function that produces a value.
8. 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.
9. What is conditional execution? Conditional execution is created with the if keyword in JavaScript.
10. What kind of keyword do you need to use to invoke conditional execution? If
What is an expression?
- A fragment of code that produce a value
What is a binding?
- Binding or variable are used to cath and hold value
What is an environment?
- The enviroment is the collection of binding and their value.
What is a function?
- A piece of program wrapped in a value.
Give an example of a function.
- alert(“hi”) or prompt are function on the console that will produce effect of showing a dialog box in the page.
What is a side effect?
- The side effect is the result of a function that produce a dialog box on the screen.
Give an example of a function that produces a side effect and another function that produces a value.
- prompt(“Hello world”)
console.log(5*3+2)
What is control flow?
- Control flow happen when a program contain more than one statement to execute those statement in order from top to bottom.
What is conditional execution?
- Conditional execution is a branching of a program to create two path or possible outcome.
What kind of keyword do you need to use to invoke conditional execution?
- To invoke conditional execution we need if and else.
-
Any length of code that produces a value.
-
A binding is a defined piece of memory that contains specific information.
-
An environment is the set of variables & their values that exist in the memory.
-
A function is a defined section of a program that executes a specific task.
-
function sum( “Janes Apples” + Bob’s Apples")
-
A side effect is any application state changed that can be observed outside the function. Side effects can include modifying any external variable.
-
console.log produces side effect while ben=9 produces a value
-
Control flow is the order in which a program will execute the code.
-
A conditional execution is used when a website has input from a user that allows the program to behave differently based on different information entered by the coder.
-
if
- A unit of code that can be evaluated to a value.
- A term for a variable that catches on to a value that is kept in memory.
- The collection of bindings and their values that exist at a given time.
- A piece of program wrapped in a value.
- Alert function - shows a dialogue box with a message on the screen.
- A result from a statement that actually changes something, such a display on a screen or the internal state of the machine.
- Prompt function causes a dialog box requesting input and thus produces a side effect; Math.max produces a value.
- The order in which statements are evaluated in a program.
- A branching in a control flow where the branch executed by the program depends on a the situation at the time.
- The “if” keyword and the “else” keyword.
1.A fragment of code that produces a value
2. It holds old values to new values
3. A collection of bindings and their values that exist at a given time
4.is a piece of program wrapped in a value
5. prompt(“Enter passcode”);
6.Showing a dialog box or writing text to the screen*
7.
8. *When you have more than 1 statement and put in a story format from top to bottom
9. When you want to create a branch road
10. if
-
What is an expression?
A. A fragment of code that produces a value. Any value of code that is written is an expression. -
What is a binding?
A: Something that catches and holds values -
What is an environment?
A:The collection of bindings and their values that exist at a given time -
What is a function?
A: a piece of program wrapped in a value -
Give an example of a function.
A: Prompt (’‘enterpasscode’’) -
What is a side effect?
A: 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.
A: Let num = 0;
const func = () => {
num = 1;
return true;
}
func (); -
What is control flow?
A: 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: 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?
A: the ‘‘if’’ keyword
- A piece of code that produces an outcome
- A word that connects to a specific piece of data. A number, phrase, etc…
- The collection of bindings and their memory
- A piece of program wrapped in a value.
- console.log
- Any data, bindings, or environment change that occurs due to the outcome of a function.
- if a > b; { c = True}
if (a > b) console.log(True) - A program executes from top to bottom
- There are statements such as if or if else that create the chance to be skipped depending on the environment when it is run.
- “if”
1.What is an expression?
-A piece of code that tells computer to do something, A fragment of code that produces a value, and a simplest kind of statement with a semicolon after it.
2.What is a binding?
-the act of pointing or connecting or matching a variable to a value that it can be disconnected at anytime and point to the new value.
or in other language connecting to data elements together.
3.What is an environment?
-The combination of Variables and their values at the given time
4.What is a function?
-a piece of code or program which is wrapped in a value, and can be executed or run by applying or calling or invoking it.
5.Give an example of a function.
-Var ,function, alert
6.What is a side effect?
-showing a dialogue box or writing text to a screen is a side effect that can produce an expression and returns the value and make it observable.
7.Give an example of a function that produces a side effect and another function that produces a value,
-document.write() , prompt(what’s your name)
8.What is control flow?
-The order of the instructions that gets called
9.What is conditional execution?
-The functions that help to have a control of the flow of the programs ignorer to get different result based on different inputs
10.What kind of keyword do you need to use to invoke conditional execution?
if () {} else if () {} else {}
while () {}
- An expression is any fragment of code that produces a value.
- A binding is the way we tie a variable to the computer’s memory. It’s composed by a binding creation command (var, let, const) , a binding name (the name we decide to give it), the = operator, and the binding value (everything after the operator).
3)Collection of bindings and their values that exist at a given time.
4)Functions are pieces of program that performs a specific task. - prompt, console.log, math.max, math.min, alert.
6)A side effect is when a certain statement changes the statements that come after it.
prompt(“Enter number”);
console.log(Math.min(2, 4));
8)The order certain statements are being executed.
9)When the program takes different branches based on the situation at hand.
10) Conditional expressions (IF, else if…)
-
What is an expression?
An expression is a fragment of code that produces a value. -
What is a binding?
Bindings (variables) are “tentacles” that grasp values. -
What is an environment?
An environment are 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. Such values can be applied in order to run the wrapped program. -
Give an example of a function.
For example, in a browser environment, the binding promt holds a function that shows a little dialog box asking for user input. This dialog box could ask for a password. -
What is a side effect?
A side effect is the reaction caused by invoking, calling, or applying a function. -
Give an example of a function that produces a side effect and another function that produces a value.
Prompt function produces a dialog box as a side effect, and Max.math function produces the greatest value from any amount of number arguments. -
What is control flow?
Control flow is the order in which statements are executed. -
What is conditional execution?
Conditional execution is an ability programs have to create branching roads depending of the situation at hand or answers given. -
What kind of keyword do you need to use to invoke conditional execution?
If, else.
- What is an expression?
An expression can be simplified to a value. It can be functions that produce a value, or just a value itself.
- What is a binding?
A binding is a string that has been redefined to represent an expression. The value of the expression is called when the binding is called.
- What is an environment?
An environment is the collection of all bindings at any state of the program’s operation.
- What is a function?
A binding that performs a pre-programmed operation on an input and produces an output from it.
- Give an example of a function.
Number.isNaN() returns a “true” value if the argument is Not a Number, or a “false” value if
the argument is a number.
- What is a side effect?
A side effect is the output produced by a function.
- 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 is prompt. A function that produces a value is Math.max
- What is control flow?
The order of operations that JavaScript will read the code, moves from top to bottom.
- What is conditional execution?
When we use if/else keywords it creates a “crossroads” in the program where JavaScript makes a decision based on the input given. When the if is true, it will execute the block that follows the if statement. When the if is false, it will skip the if block and will execute the else block instead.
- What kind of keyword do you need to use to invoke conditional execution?
if/else
-
a fragment of code that produces a value.
-
a binding is used to catch and hold a value. a binding does not contain the value, rather it grasps it like a tentacle for later recall.
-
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 can be executed by invoking, calling or applying it. ie - prompt(“Enter your age”);
-
see 4 (ha)
-
a side effect is; an expression that could change the internal state of a machine in such a way that it will affect the statements that come after it.
-
value producing function:
console.log(Math.max(2,4));
// -> 4
side effect producing function:
prompt(“Enter passcode”);
-
control flow - when your program contains more than one statement, in story form from top to bottom
-
conditional execution is used when you want to branch the program in different directions based on the situation, typically accompanied by the ‘if’ function. (ie - ‘if’ allows for two different answers based on the values in the statement)
-
a keyword such as ‘if’ would invoke conditional execution, due to the fact it’s direction of output in conditional on the values in the statement (input).
-
an expression is a fragment of code that produces a value.
-
binding is to catch and hold values.
3.The environment 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.
- console.log(2 + 2)
- prompt(“e.gdo sumthn”)
-
Showing a dialog box or writing text to the screen.
-
prompt(“Password Required”);
-
Control flowhen your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
-
where you create a branching road where the program takes the proper branch based on the situation at hand.
-
execution is done with (“if”) input.
1- an expression is a fragment of code that produces some sort of value, whether that is a number or a string.
2-Binding is synonymous with variable, it allows a value to be saved to be reused later in a more efficient manner. Bindings are like string leading back to a value that you have defined, if you have not defined it but are searching for it you will get Undefined as a return.
3- The environment is the list (collection) of bindings in any given program. It is never empty as there are always bindings even when you don’t set them. They may be bindings that currently play a role in the system, for example, the let binding doesn’t have to be added, because it is always there. Those bindings also cannot be changed (or used for different bindings)
4- A function is a program that is wrapped in a value, for example prompt or alert are both functions that are invoked by using the value prompt or alert.
5- alert(“Hello world”);
prompt(“password”);
6- a side effect is something that happens from running a piece of code that “changes the world” or changes something we can see. For example writing code that changes the way something looks on a webpage, or creating an alert. In short something we can visualize.
7- prompt(“hello world”);
Console.log(2 + 2)
//-> 4
8- Control flow is the way JS executes codes with more than one statement. It does this top to down.
9- Conditional executions are pieces of code that contain if statements. This is done to cause a “fork in the road” to execute or prevent statements from becoming executed. If this than this, if that then that.
10- Keyword IF
- A fragment of code that produces a value.
- its basically the same thing as a variable. It allows you to assign values to strings etc…
- 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.
- In a browser environment, the binding prompt holds a functions that shows a small dialogue box asking for user input.
- A statement that changes the internal state of the machine in a way in a way that will affect the statements that come after it.
- Prompt is an example of a function that will give you a side effect. Math.min produces a value.
- How the statements are executed.
- This is a program taking different routes based on the situation at hand. created with the if keyword.
10.Conditional keywords.
- What is an expression?
Anything in the code that expresses a value. Ex a, b, 1, 2, - What is a binding?
In general terms it means that we can connect changes to an object to the User Interface.
In JS there are tools that allow two-way binding. Which means that updates to the User Interface and underlying data model are kept in sync. - What is an environment?
You can pretty much think of JS environment in terms of who started the JS runtime.
If your JS is part of a web page, then the browser creates a JS runtime for each original tab, and all the JS does is confined within that runtime. The browser defines the ‘environment’ - what libraries and default objects are available to you. - What is a function?
A function is a set of statements that take inputs, do some specific computation, and produces an output. - Give an example of a function.
function itemtotal ( x, y) {
return (x * y);
} // where x = item quantity and y= item unit price. - What is a side effect?
This term in JavaScript refers to the concept of a function that can alter the external state of your application, this means that a function can alter parts or values of your application that don’t directly reside inside that same method. The statement that is executed automatically by the system as a ‘side effect’ of the modification of a database. - Give an example of a function that produces a side effect and another function that produces a value.
const colors = [‘Blue’, ‘Red’, ‘Green’];
const appendColor = (color, newColor) => {
color.push(newColor);
return color;}
const colors = appendColor(colors, ‘Yellow’);
console.log(color); // [‘Blue’, ‘Red’, ‘Green’ , 'Yellow];
console.log(colors); // [‘Blue’, ‘Red’, ‘Green’ , Yellow];
example of a function a value see 5 above. - What is control flow?
Java Script supports a compact set of statements that specifically control flow.
For example the block statement, which is used to group statements. The block is delimited by a pair of curly brackets: { … … … }
9)What is conditional execution?
Conditional statements control behavior in JavaScript and determine whether or not pieces
of code can run. - What kind of keyword do you need to use to invoke conditional execution?
Examples are if statements, else statements, and elseif statements .
What is an expression?
Expression is a fragment of code thas produces a value.
What is a binding?
Binding is used to cacht and hold values in javascript.*
What is an environment?
Enviroment is the colection of bidings and their values that exist at a given time.
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.
Give an example of a function.
prompt function
What is a side effect?
Side Effect is when a function produce a showing dialog or writing texto to the screen.
Give an example of a function that produces a side effect and another function that produces a value.
Side Effect – prompt
Value – math.min
What is control flow?
Flow control is the order in which statements are executed, from top to botton like tell a story.
What is conditional execution?
conditional execution is whem 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?
Keyword if and else
- Any piece of code that produces a value.
- A binding is a variable, it points to/holds on to values.
- The collection of bindings/variables and their values that exist at a given time.
- A set of statements that performs a task or calculates a value via taking an input and returning an output based off that input.
- Math.max(10,20)
- Any application state change that is observable outside the called function other than its return value.
- a. alert(“hello, world”);
b. Math.max(2,3); - The order in which statements are executed(top to bottom, left to right).
- Setting code to be executed only if a certain condition is met.
- if