-
An expression is a fragment of code that produces a value.
-
A binding is a type of statement that catches and holds value.
-
An environment is a collection of bindings and their values.
-
A function is a piece of programme wrapped in a value,
-
Prompt, alert etc. prompt(“When will you be a blockchain Dev?”);
-
You could say a side affect “changes the world around it”. An example of this would be changing the UI that is produced or something that causes the statements that follow it to change.
-
An example of a function that a side affect produces could be showing dialogue or writing to the screen.
An example of a function that produces a value could be something like:
console.log(Math.min(4,8)); -
The control flow is the order in which the computer executes statements in a script.
-
Conditional execution is when code is only executed if certain conditions are met.
-
If
[quote=“ivan, post:1, topic:3069”]
-
What is an expression?
Any unit of code that can be evaluated to a value is an expression . -
What is a binding?
The bind () method allows an object to borrow a method from another object without making a copy of that method. -
What is an environment?
The collection of bindings and their values that exist at a given time is called
the environment. -
What is a function?
A function is a piece of program wrapped in a value. -
Give an example of a function.
For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input. -
What is a side effect?
Showing 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(Math.max(2, 4));
// → 4
Value
console.log(Math.min(2, 4) + 100);
// → 102 -
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?
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?
the “if” keyword.
- What is an expression?
“A fragment of code that produces a value”
- What is a binding?
Something used to catch and hold values for future use. (can use “let” key word to indicate you want to assign a binding)
- What is an environment?
The group of bindings that exist at a given time makeup the environment (kind of like ground rules or definitions the program has as a baseline at any given time)
- What is a function? 5. Give an example of a function.
It’s a piece of program (or mini program kind of) wrapped up in a value (i.e. prompt(“enter name”) would pop up a prompt window on a browser that said “enter name” text with box to type because the browser knows the mini program or function that is prompt()
- What is a side effect?
A thing that happens with a given function. For instance, in the example above a dialogue box pops up on the screen when the prompt() function is invoked.
- Give an example of a function that produces a side effect and another function that produces a value.
prompt(“type your name”) would produce a dialogue box on the browser side effect
And
console.log(2 + 2) would return a VALUE of 4
- What is control flow?
The workflow or order that a program executes multiple statements. Which is from top to bottom like a story.
- What is conditional execution?
It sets a condition for the program to follow. So if one outcome occurs it will follow one set of instructions and if a different outcome (or input) occurs it will follow a different set of instructions.
- What kind of keyword do you need to use to invoke conditional execution?
The keyword if
- Expression is a fragment of code that produces a value.
- A binding or variable is something which catches and holds value.
- 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.
- alert(“Welcome to this website”);
- Side effect is for example when a function shows a dialog box or text to the screen.
- prompt(“Hello!”) , console.log(Math.max(2, 4));
- Control flow is the order in which our statements are executed in JS.
- Conditional execution is when we instruct the program to take an alternative way from the usual straight control flow, based on the situation at hand.
- if , if else.
- What is an expression?
a piece of code that results to a value - What is a binding?
binding is the defined stored value to a variable, it will remain binded to that variable until changed. - What is an environment?
a collections of bindings and their values at a given time - What is a function?
a piece of program wrapped in a value - Give an example of a function.
alert(“Welcome to the Danger Zone”); - What is a side effect?
any expression or function that displays/ changes the string or value on the webpage, basically if the program changes visibly it is a side effect. - Give an example of a function that produces a side effect and another function that produces a value.
alert(“this is gonna be fun”); side effeft
console.log(4*4); value, no side effect - What is control flow?
the order of controlling flow of code, - What is conditional execution?
essentially a fork in the road, the java code will determine the path followed - What kind of keyword do you need to use to invoke conditional execution?
If
Binding, Function, and Control Flow Answers
-
An expression is a fragment of code that produces a value. Every value whether number or string is an expression.
-
A Binding also known as a variable is a way to catch and hold values. Don’t think of binding as a box or a container rather it’s more like “tentacles” that “grasp, and holds” values. It’s a way for your program to “remember” something important to the lines of code.
-
The collection of bindings and their values that exist at a given time is called the environment.
-
A function is a piece of the program (code) wrapped in a value. These values can be invoked in order to run the wrapped program.
-
An example of a function:
function addCal(x,y){
return x+y
};
to invoke our function:
addCal(20, 7);
-
Showing a dialog box or writing text to the screen is whats known as a “side effect”, some functions are more useful because of the side effects they produce. In some cases, a function can produce a value and not need a side effect to be useful.
-
This is a function that will produce a side effect it interacts with the outside world:
function thisFunction() {
alert(“Ivan On Tech!”);
} ;
This is a function that produces no side effects it changes the state its in:
function multiCalc(x, y) {
return x * x };
-
How your program gets executed from top to bottom is referred to as control flow.
-
A conditional execution is when a piece of your code is only invoked when a predetermined condition is met.
-
If, and Else If statements.
-
What is an expression?
code producing a value. -
What is a binding?
A bind is a kind of an assignment. You can bind an specific word in your code to a value or to a function. Binding keeps valid and maintain assignment until changed. You can use the value or the function by using the word you used to make the binding. -
What is an environment?
The collection of bindings and their values in a given moment of time. -
What is a function?
It is the wrapping of some code into a value. -
Give an example of a function.
const duplicate(x) {
return 2* x;
} -
What is a side effect?
It is something happening in a piece of code that may affect or produce actions outside its scope. -
Give an example of a function that produces a side effect and another function that produces a value.
console.log(“this produces a side effect”); -
What is control flow?
Usually programs have way more than one statement. These statements are executed as if they were a story: from top to bottom. -
What is conditional execution?
Sometimes you need your program to behave differently depending on some conditions. This can be achieved through conditions execution by using the if keyword. -
What kind of keyword do you need to use to invoke conditional execution?
if
-
What is an expression?
A piece of code that produces a value. That also includes just a value itself. -
What is a binding?
A binding is a way to catch and hold a value. It is synonymous with variable. -
What is an environment?
The environment is the collection of bindings and their values. There are bindings and values placed into the environment before the program even begins to run. -
What is a function?
A function is an expression (variable) with a piece of program within it. It is called/invoked/applied by putting parenthesis after the expression and, if needed, values within the parenthesis. The values are passed to the program. -
Give an example of a function.
Math.max() -
What is a side effect?
A side effect is when a function shows something on the screen. -
Give an example of a function that produces a side effect and another function that produces a value.
console.log() produces a side effect. Math.max() produces a value. -
What is control flow?
When there is more than one statement in a program, control flow is the sequence order that the program statements are executed in. -
What is conditional execution?
Conditional execution is a branching point where a program statement makes a choice based on the environment and chooses one path out of two or more available paths. -
What kind of keyword do you need to use to invoke conditional execution?
‘if’ Specifically it is if(condition){ ; }
1.A fragment of code that produces a value
2. A binding or variable catches or holds values. Binding link a value to an arbitrary word defined by the program author.
3. The collection of bindings and their values that exist at a given time.
4. A piece of program wrapped in a value. Such values can be applied in order to run the wrapped program.
5. “prompt” triggers a browser pop-up with a user entry field.
6. A side effect modifies some state variable value outside its local environment.
7. "alert’ prouces a side effects “math.max” produces a value
8. The order or sequence of operations of a program
9. When code is to be executed if, and only if, a certain condition holds.
10. “if”
- What is an expression?
A fragment of code that that returns a value.
- What is a binding?
Biding is a variable, an element or object that points to a value (or also, depending to the language, it could point to a function, class, etc).
- What is an environment?
A collection of variables existing with their values at a certain time.
- What is a function?
A fragment of code wrapped in a value, it can accept arguments or parameters, and can be called more than once time.
- Give an example of a function.
console.log(“Hello forum”);
- What is a side effect?
A side effect is a change that a function makes other than returning a value, like printing text on the screen, or deleting a file, or making a request to a webpage.
- Give an example of a function that produces a side effect and another function that produces a value.
side effect: alet(“This is a side effect”);
return value: console.log(“Returning this text”)
- What is control flow?
The path a program follows while reading the code, from top to bottom.
- What is conditional execution?
When the program finds a conditional to execute, depending on the condition, it will choose a branch to take.
- What kind of keyword do you need to use to invoke conditional execution?
If else are the basic ones.
- expression is fragment of code that produces value.
- binding means setting value to variable.
- collection of bindings and values that exist at same time.
- function is piece of program put in value (I have been told that coders are lazy and if you can write one word instead of two you use allways one)
- prompt(“give value”);
- side effect is effect that happens later in program due to previous function like showing textbox for user to write in to.
7.prompt(“Password”);
Math.max(34, 69); - order at which code works, usually from top to bottom, left to right.
9.when program does something out of order like skips next lines if number > 5. - if
-
What is an expression?
Any fragment of code that produces is a value is called an expression.
Expressions hence evaluate down to a value.
Expressions can contain expression within them written within parentheses. -
What is a binding?
Bindings are variables that Javascript uses to ‘catch on’ or ‘hold on’ to values.
Bindings can be defined by keywords
“let”, “var”, “const”
Binding names must be a word and can have digits in it, but it cannot be start with a digit.
Binding names can include $ and _ underscore.
Bindings cannot have a period “.” in them -
What is an environment?
The set of bindings and their related values assigned create an “environment”. -
What is a function?
Function is a statement made up of variables and values to solve to a final value. -
Give an example of a function.
prompt(“Enter Password”); -
What is a side effect?
Functions that produce a value that changes the state of a machine or makes a change in the world are termed “side effects”. Example displaying something on the screen.
Some functions produce a value but have no impression on the world and get immediately discarded. -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Enter Password”); - side effect is a dialog box.
!false; - no side effect just produces a value which gets thrown away. -
What is control flow?
Control flow it the order in which JavaScript executes the statements. -
What is conditional execution?
Conditional execution occurs when the program branches off to executive different set of code based on situations, events, conditions, and not straight top to bottom flow. -
What kind of keyword do you need to use to invoke conditional execution?
The keyword “if” invokes the conditional execution. “else” keyword can be used together with “if” to create separate alternative execution paths.
What is an expression?
Every piece of code that produces a value is an expression.
What is a binding?
Bindings points at a value that is defined at first. Bindings catch and hold values until it gets connected to a new value.
What is an environment?
The enviroment is a 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. Executing a function is called invoking, calling, or applying it.
Give an example of a function.
prompt(“Give me a number”);
What is a side effect?
Showing 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.
prompt(“Give me a number”);
console.log(Math.max(2, 4));
What is control flow?
Programs that contains more than one expressions always execute from top to bottom. This is called control flow.
What is conditional execution?
Sometimes there are more possabilities to go, so the program can take 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” and “else”
- An expression is a fragment of code which produces a value.
- Binding is when you point/reference a variable to a value.
3.The collection of variables and their values that exists at any given time is called the environment. - A function is a piece of program wrapped in a value.
- alert(“Good Morning”)
- A side effect is any application state change that is observable outside the called function other than its return value.
side-effect:
function plusWithSideEffects(x, y) { alert(“This is a side effect”); return x + y; }
value:
console.log(Math.max(2,4));
8. The order in which statements are executed.
9. A statement where we choose between two different routes based on a boolean value.
10. if, else if, else
- 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
-
What is an expression?
A fragment of code that produces a value is called an expression -
What is a binding?
To catch and hold values, JavaScript provides a thing called abinding -
What is an environment?
The collection of bindings and their values that exist at a given time is called the environment -
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?
Showing a dialog box or writing text to the screen is aside effect -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Enter passcode”); side effect
console.log(Math.max(2, 4));// → 4 value -
What is control flow?
When your program contains more than one statement, the statements areexecuted as if they are a story, from top to bottom. -
What is conditional execution?
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
- A fragment of code that produces a value.
- To catch and hold values, JavaScript provides an entity called a binding, or variable.
- The 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 function.
- Functions that do not produce values, produce side effects such as showing a dialog box or writing text to the screen.
- Function that produces side effect:
Prompt (" Enter text");
Function that produces value:
Console.log ( 1+1);
8. The order in which the statements of a program are being executed.
9. Conditional execution is a type of control flow, where specific piece of code is executed only of certain condition holds.
10. if, else.
-
A fragment of code that produces a value is called an expression. Every value that is written literally is an expression.
-
To catch and hold values JavaScript provides a thing called a binding or variable.
eg. let caught = 5 * 5;
This keyword let indicates that this sentence is going to identify a binding.
3.A collection of bindings and their values that exist at given time is called the environment.
-
A function is a piece of program wrapped in a value.
-
prompt(“Enter Password”);
-
A side effect is any application state change that is observable outside the called function other than its return value.
-
Showing a dialog box or writing test to the screen is a side effect.
-
The control flow is the order in which the computer executes statements in a script.
-
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 situational execution.
-
if, else, else if and switch
-
What is an expression?
an expression is a fragment of code that produces a value -
What is a binding?
a binding creates a connection between two items -
What is an environment?
The collection of bindings and their values that exist at a given time is called the environment . -
What is a function?
A function is a piece of program wrapped in a value (like prompt) -
Give an example of a function.
prompt -
What is a side effect?
Showing 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, value: prompt -
What is control flow?
it is the direction the program plays out -
What is conditional execution?
it means that it execute only if a certain condition is met -
What kind of keyword do you need to use to invoke conditional execution?
if
- An operation that produces a value.
- A way to sort values by ‘‘tagging’’ them with names, like let lolol=(‘lol’) where the binding name lolol holds the string value ‘lol’.
- The bindings and their values that exist at any given time makes up ‘‘the environment’’.
- A function is a piece of program wrapped in a value, like prompt(’‘enter your private key Kappa’’) which in a web browser makes a dialog window popping up.
- A side effect is when a dialog box or text writing on the screen appear.
- prompt(‘yo’) shows ‘yo’ in a dialog box on screen (side effect) while console.log(Math.max)(2,4)); outputs 4 in the console since it’s the bigger number of the arguments.
- In which order the written code is executed.
- Example: Execute ‘‘this’’ only if ‘‘this2’’ happens, otherwise keep doing ‘‘this3’’. Executing parts of the code depending on the current values.
- if