Binding, Functions and Control Flow - Reading Assignment

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. Aka variable
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.
Math.pow(2,3)
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.
function testf (){
age=prompt (“please provide your age”)
return "my age is: "+age;
}
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?
The order by which the program execute statements depends in some conditions.
What kind of keyword do you need to use to invoke conditional execution?
if, else if, else

  1. Code that resolves a value
  2. Code stored in memory
  3. A collection of bindings and their values
  4. An expression wrapped in a value
  5. alert("this message is being read:)
  6. Observable change in state of the application
  7. alert(“alert function will produce a side efect”) console.log(1+1); will produce a value
  8. The flow of execution form top to bottom
  9. A point where the program decides what to do based of certain conditions
  10. “if”
1. What is an expression? A fragment of code that produces a value.
2. What is a binding? Its to catch and hold values.
3. What is an environment? The collections of binding and their values that exist on a given time.
4. What is a function? It’s a piece of program wrapped in a value. Such values can be implied in order to run the wrapped program.
5. Give an example of a function. Var, prompt, if
6. What is a side effect? 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. Prompt and Sum.
8. What is control flow? Its way to describe the flow of the statements from top to bottom.
9. What is conditional execution? It’s a way to command that a piece a program only executes if, and only if, the condition holds.

What kind of keyword do you need to use to invoke conditional execution? If.

  1. A fragment of code that produces a value is called an expression.
    2.In programming it is methode of catching and holding values. bindings are tentacles, rather than boxes.
    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. Such values can be applied
    in order to run the wrapped program.
  2. prompt function, consol.log
  3. when executed fuction change the world
    7.side effect - comsole.log, values - Math.max
    8,when program go straight.
    9.Situation where the program takes the proper branch based on the
    situation at hand, diffrent than control flow.
  4. If

What is an expression? - its everything that ends with an ;
What is a binding? binding is the association of the name of the variable to a memory registry
What is an environment? is the colletction of the binding and its values
What is a function? a function its a block of code wrapped in {}
Give an example of a function.
function example(num1, num2)
{
return num1>num2;
}
What is a side effect? its the result that a function gives, like prompt;
Give an example of a function that produces a side effect and another function that produces a value - .alert(“this produces a side effect”); Math.max(2,4); this produces a value
What is control flow? its when you have multiple statements and the program is read from top to bottom
What is conditional execution? its when you have a condition that can make you change to other function for example,
What kind of keyword do you need to use to invoke conditional execution? if else

What is an expression?
An expression is any statement that return a value. We can have expressions nested in other expressions .
What is a binding?
Binding is give a value a name so we can keep it for use later.
What is an environment?
Environment is all the values that are binding in our program.
What is a function?
A function is a block of code or a block of statements wrapped so we can reuse it anytime we need it just calling it.
Give an example of a function.
function print(doc) {
console.log(doc);
}
What is a side effect?
Side effect is for example when we call a function and this function change something else other than the return value of the function
Give an example of a function that produces a side effect and another function that produces a value.
side effect
let x = 0;
function count() {
x = 10; // change the var value to the var outside of the function
while (count<100) {
console.log(count);
}
}
An a function that produces a value:
function sum(a ,b) {
return a + b;
}
What is control flow?
Control flow is the way the program follow the orders in a program.
What is conditional execution?
A conditional execution is when the flow of the program has to check certain condition before continue and depend of the condition is the path that is going to execute.
What kind of keyword do you need to use to invoke conditional execution?
if , else

  1. An expression returns a value
  2. Binding is when you allow a variable to be a value
  3. Environment is the the collection of bindings at a point in time
  4. A function is a group of code that can be accessed by the program to compute a value
  5. function add (a, b) { return a + b; }
  6. Side effects happen when a statement changes the environment
    and affects the statements that come after it.
  7. let theNumber = Number(prompt(“Pick a number”));
    if (!Number.isNaN(theNumber)) {
    console.log("Your number is the square root of " +
    theNumber * theNumber);
    }
  8. Conditional execution is like a fork in the road. The program uses if, else, if else to evaluate a condition and continue executing the branch of code based on the value returned from that condition.
  9. if, else, if else

1. What is an expression?
An expression is a fragment of code that produces a value. Expressions can contain other expressions.

2. What is a binding?
A binding allows you to catch and hold values in JavaScript by invoking a reference name linked to the memory address where it is stored. Bindings are preceded by keywords “let”, “var” or “const”.

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. These values can be applied in order to run the wrapped program.

5. Give an example of a function.
prompt("Enter passcode")

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.
side effect: console.log(), value: Math.max()

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 a branching path where the program chooses which branch to take based on a boolean condition.

10. What kind of keyword do you need to use to invoke conditional execution?
The “if” keyword

1 Like
  1. An expression is a piece of code that produces a value.
  2. A binding is a way that a value is bound to memory, it allows the program to use values until they are no longer needed and their binding is either removed or dissipates.
  3. Environment is the place where your code sits and runs, generally holds your values and bindings.
  4. A function is something that takes in none or more arguments (values) and spits out another value. Generally its a program wrapped in a value.
  5. consol.log(“Paul”) is a function
  6. Side effect is the result of a function
  7. A function that produces a side effect would be alert(“boom!”), a function that produces a value would be console.log(Math.min(2, 6) + 100)
  8. In coding in general code flow generally refers to the use of statements to enable flow through the program and attain the desired result or process that you want your program to carry out.
  9. An if statement is an example of conditional execution and allows the code to branch off given a ‘condition’ before it resumes normal flow with the result of the conditional statement.
  10. An 'if keyword allows conditional statements

What is an expression?
An expression is a fragment of code that produces a value.

What is a binding?
A Binding is a defined variable use to store values

What is an environment?
The environment is a collection of bindings

What is a function?
A function is a block of reusable code that can be called at any time during a program.

Give an example of a function.
function showprompt(message) {
console.log(message);
}

What is a side effect?
A side effect if the “effect” the function has on the program, i.e. showing a prompt / dialog box

Give an example of a function that produces a side effect and another function that produces a value.
Math.max(3,4);

What is control flow?
A program that contains more than one statement wich are executed in “story form”, from top to bottom

What is conditional execution?
A conditional execution is a part of code whos execution is dependant on certain conditions.

What kind of keyword do you need to use to invoke conditional execution?
if, else

  1. A fragment of code that produces a value.
  2. Naming an expression.
  3. The collection of bindings and their values that exist at a given time.
  4. A function is a piece of program wrapped in a value.
  5. alert(“hello world”);
  6. Showing a dialog box or writing text to the screen is a side effect.
  7. Produces side effect prompt(“Enter passcode”); Produces value console.log(Math.max(2, 4));
  8. When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
  9. If we desire to make the program act different accordingly situation, we create a branching road, where the program takes the proper branch based on the situation at hand.
  10. If, else

Binding, Function an Flow Control


  1. An expression is a piece of code that produces a result.
  2. A binding is a variable.
  3. The environment is a collection of bindings that exist at the current time.
  4. a functions is a group of bindings or a another function that can be called from another part of the codebase.
  5. Function example : Alert("Test");
  6. outputting something to the screen or a dialogue box is a side effect.
  7. Side effect --> prompt("Enter Passcode"); Value -->console.log(23 == 82)
  8. Flow control is the way in which you change the flow of execution instead of just top to bottom.
  9. its is a "If, Then , else" statement if a certain binding is true then do something else do something.
  10. if (condition) {do stuff if true} else {do stuff if false}
  1. What is an expression?
    expressions is any code, that produces a value

  2. What is a binding?
    a point to a value

  3. What is an environment?
    the collection of bindings and there values at a given time

  4. What is a function?
    a piece of program wrapped in a value

  5. Give an example of a function.
    function coolfunc(arg1) {
    return arg1 + 2;
    }
    coolfunc(2);
    // 4

  6. What is a side effect?
    when statements are changing something else (displaying something on screen or modifying statements after), this is called a side effect

  7. Give an example of a function that produces a side effect and another function that produces a value.
    alert(“Hey champs”);

function coolfunc(arg1) {
return arg1 + 2;
}
coolfunc(2);
// 4

  1. What is control flow?
    the order in which statements are executed

  2. What is conditional execution?
    a part of the code is only executed if a defined condition is met.

  3. 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 reduces down to a value.
What is a binding?
a binding ties a value to a name. it allows a value to be stored for later use
What is an environment?
An environment contains all of your programs bindings and statments
What is a function?
A function is a reusable piece of code that is defined once and used throughout the program to perform a task.
Give an example of a function.
console.log()
What is a side effect?
It is how the function effects the world.
Give an example of a function that produces a side effect and another function that produces a value.
consol.log() produces a side effect of writing to the screen. Math.max() gives the maximum value of the arguments provided.
What is control flow?
it describes the flow of the programs execution. The program can go forward, loop, or fork.
What is conditional execution?
Conditional execution allows the code to run only if the condition is met. Otherwise, it will be skipped.
What kind of keyword do you need to use to invoke conditional execution?
if

  1. An expression is a fragment of code that produces a value. 2 + 2 = 4, the whole line itself, is an expression.

  2. A binding is when a value is tied to another term. let a = 3, in this case the three is bound to a and any reference to a from that point forward would be synonymous with the number three.

  3. An environment is the collection of bindings at any given time in a program.

  4. A function is a small program that produces a value.

  5. function addNum(a, b) {
    return a+b;}
    addNum(2, 2);
    4

  6. A side effect is when a function changes the state of the page or its internal state in some way. A function that creates a dialog box would be an example. As compared to the above function that only returns a value.

  7. The above function produces a value. For a side effect:
    function alertName(name) {
    alert("Hey " + name);}
    alertName(“Ivan”);
    Alert box pops up with “Hey Ivan”

  8. Control flow is the order in which a function operates. It goes from top to bottom. Based on that, the first part of a function can alter the second part.

  9. A conditional execution gives a result based on if a condition is met or not met. If you enter a name equal to or longer than eight characters – alert: that’s a long name. Else, that’s not a very long name.

  10. If is the word used to invoke conditional execution.

What is an expression?
A fragment of code that produces a value. Every value that is written literally is an expression.
What is a binding?
To catch and hold values JS uses a binding or variable using a keyword to define it.
What is an environment?
Environment is the collection of bindings and their values that exists at a given time.
What is a function? Give an example of a function.
Function is a piece of a program wrapped in a value. An example is a dialog box asking for user input in the browser.
What is a side effect?
A statement that causes an observable change (either external or internal) in a way that will affect the statements that come after it. A function that produces a side effect would be one that shows a dialog box or writes text to the screen.
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Enter passcode”);
console.log(Math.max(2,4));
// 4
What is control flow?
Control flow occurs when a program contains more than one statement and the statements are executed from top to bottom.
What is conditional execution? What kind of keyword do you need to use to invoke conditional execution?
Conditional execution is used when code is executed based on if the condition is true or false. Keywords used are ‘if’ or ‘else’.

1. What is an Expression?
A fragment of code that produces a value.

2. What is a Binding?
When a value is linked to a variable.

3. What is an Environment?
A collection of bindings and their values that exist at any given time.

4. What is a Function?
A piece of a program wrapped in a value.

5. Give an example of a function.
alert(“Hello World”);

6. What is a Side Effect?
Any application state that is observable outside the called function other than its return value.
Example:
Showing an alert or a prompt.

7. Give an example of a function that produces (a) a side effect & (b) a value.
a) console.log();
b) math.max();

8. What is Control Flow?
This ensures statements are executed in the proper order.

9. What is Conditional Execution?
Code that will only execute if a certain condition is met.

10. What kind of keyword do you need to invoke Conditional Execution?
IF/ELSE statement

  1. A fragment of code that produces a value
  2. Used to catch and hold a value. Also called a variable or constant.
  3. Collection of bindings and their values at a given time.
  4. Piece of program wrapped in a value. These values can be applied in order to run the wrapped program.
  5. prompt (“enter the password”);
  6. Something that affects the world, either it displays something on the screen or it changes statements that come after it.
  7. prompt ("enter the password); math.max(1,2);
  8. When a program has more than one statement, the way the statements are executed from top to bottom.
  9. It gives the code an alternative so 2 different roads can be taken.
  10. if

1. What is an expression?

An expression is a fragment of code that produces a value.

2. What is a binding?

A binding catches and holds values.

3. What is an environment?

An environment is the collection of bindings and their values, which 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.

prompt(“Enter name”);

6. What is a side effect?

A side effect is a statement that could change the machine’s internal state, and thus will affect the following statements.

7. Give an example of a function that produces a side effect and another function that produces a value.

Side effect function:
prompt(“Enter name”);

Value function:
console.log(Math.min(2, 4));

8. What is control flow?

Control flow is the order in which the computer executes statements in a program.

9. What is conditional execution?

Conditional execution is where the program takes the proper branch, based on the
situation.

10. What kind of keyword do you need to use to invoke conditional execution?

You need to use the if keyword to invoke conditional execution.

  1. A fragment of code that produces a value.
  2. Basically a variable.
  3. A collection of bindings and their values that exist at a give time.
  4. A function is a piece of program wrapped in a value.
  5. alert(“ICO”); is a function.
  6. A side effect is any application state change that is observable outside the called function other than its return value. Side effects include: Modifying any external variable or object property (e.g., a global variable, or a variable in the parent function scope chain).
  7. let num = 0;
    const func = () => {
    num = 1;
    return true;
    }
    func();
  8. The order in which the computer executes statements in a script.
  9. Not all programs are just straight roads. When we create branches to the roads it is called conditional execution.
  10. For example IF