Binding, Functions and Control Flow - Reading Assignment

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

  2. What is a binding?
    Mechanism JavaScript uses to catch and hold variables, by establishing a relationship between a variable and a value.

  3. What is an environment?
    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.
    console.log()

  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.
    side effect: prompt(); value: Math.max();

  8. What is control flow?
    The order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.

  9. What is conditional execution?
    Conditional execution controls whether or not the core will execute an instruction. Most instructions have a condition attribute that determines if the core will execute it based on the setting of the condition flags.

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

1 Like
  1. Any valid unit of code that produces a value is called an expression.
  2. Bindings or variables are containers for storing data (values).Or more accurately, you should imagine bindings as tentacles, rather than containers. Because bindings (as their name suggests) do not ‘contain’ values; they ‘grasp’ them, e.g. two bindings can refer to the same value.
  3. A collection of bindings and their values that exist at a given time is called the environment.
  4. A function is a block of code designed to perform a particular task. A JavaScript function is executed when “something” invokes it (calls it) in order to run the wrapped program.
  5. Using console.log to output values when in the JavaScript console of all modern web browsers is an example of a function.
  6. Showing a dialog box or writing text to the screen is known as a side effect. A lot of
    functions are useful because of the side effects they produce.
  7. In a browser environment, the binding prompt is an example of a function that produces a side effect that shows a little dialog box asking for user input. Whereas, an example of a function which produces a value, is the function Math.max which takes any amount of number arguments and gives back the greatest e.g. console.log(Math.max(2, 4)); // → 4.
  8. When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom; this is known as control flow. The semicolon ( ; ) character is used to separate statements in JavaScript code.
  9. 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.
  10. You need to use the ‘if’ keyword to invoke conditional execution in JavaScript.
1 Like
  1. It is a fragment of code that produces a value.
  2. It’s something used to catch or hold values.
  3. It’s a collection of bindings and their values that exist at a given time.
  4. It is a piece of program wrapped in a value.
  5. prompt(“Enter Password”);
  6. It’s what is produced by the function such as a dialog box.
  7. a) prompt(“Enter password”);
    b) console.log(Math.max(2,4));
  8. When your program contains multiple statements they are executed from top to bottom.
  9. When a program takes the proper branch based on the situation at hand.
  10. if, else if, else.
1 Like
  1. A fragment of code that resolves to any value.
  2. A tool that is used to catch and hold values. They do not “contain” values; they “grasp” them. Bindings can be created by using the let. var. or const. terms.
  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.A lot of the values provided in the default environment have the type of function.
    5.Number(prompt(“pick a number”).
  5. Any application state change that is seen outside of the scope of the called function is a side effect. Showing a dialogue box or writing text to a screen is a side effect.
  6. Prompt(“enter password”). Produces a drop down asking for a password.
    OR
    Console.log(Math.max(2,4)). Outputs the largest number inside the brackets.
  7. /Control flow is the way in which code is executed; as a story from top to bottom.
  8. Where the code is executed provided a condition is met.
  9. if, if.else, while, do and for
1 Like
  1. What is an expression?
  • A fragment of code that produces a value is called an expression. Every value
    that is written literally. Expressions can contain other expressions
  1. What is a binding?
  • To catch and hold values. After a binding has been defined, its name can be used as an expression. The value of such an expression is the value the binding currently holds
  1. What is an environment?
  • The collection of bindings and their values that exist at a given time is called
    the environment.
  1. What is a function?
  • Is a piece of program wrapped in a value
  1. Give an example of a function.
  • prompt(“Enter passcode”);
  1. What is a side effect?
  • Showing a dialog box or writing text to the screen is a side effect
  1. 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

  1. What is control flow?
  • the statements are executed as if they are a story, from top to bottom
  1. What is conditional execution?
  • Conditional execution is created with the if keyword. If you have more than two paths to choose from, you can “chain” multiple if/else pairs together
  1. What kind of keyword do you need to use to invoke conditional execution?
  • if/else
1 Like
  1. What is an expression?
    A fragment of code that produces a value

  2. What is a binding?
    Binding a statement that allows JS to hold values. Binding is also called a variable.

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

  4. What is a function?
    A function is a type of program wrapped in a value. These values can be apply to run the wrapped program.

  5. Give an example of a function.

var welcome = function (greetings, name) {
    return greetings + name
};
var welcome(“Hello”, “All”)
  1. What is a side effect?
    Side effects are changes to statements made by the internal state of the machine after executing previous statements.

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

 // function with a side effect
alert(“Hello World”)

 // function with a value
console.log( Math.max (2, 4));
 // 4
  1. What is control flow?
    Control flow is the order in which our programs are executed, from top to bottom.

  2. What is conditional execution?
    A conditional execution runs our code if a first condition happens first

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

1 Like
  1. What is an expression?

‘A fragment of code that produces a value.’ It may on its own or in combination with others, most often followed by a semicolon, form a statement.

  1. What is a binding?

A binding is a variable, given a value in a statement beginning with the ‘let’ , ‘var’ and ‘const’ commands for example.

  1. What is an environment?

‘The collection of bindings and their values that exist at a given time.’

  1. What is a function?

‘A function is a piece of program, wrapped in a value.’

  1. Give an example of a function.

An example is what may show a dialog box asking for user imput

  1. What is a side effect?

Instead of producing a value, it effects subsequent statements.

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

An example outcome of a function as a side effect is a dialog box. An example of a function producing a value is the product of simple arithmetic appliying a binary operator to two existing values.Such is an argument.

  1. What is control flow?

Control flow appears to refer the process of consequetive function execution where the input of the latter is dependent on the output of the former.

  1. What is conditional execution?

This is when a latter function applies a condition to a previous functions output such that if that output is of a certain type then what is executed by the latter function is different to if the earlier output was a different type.

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

using the ‘if’ keyword

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

  2. What is a binding?
    Binding is the relationship between a name and a value in JavaScript.

  3. What is an environment?
    Environment is the collection of bindings and values in the current session or page.

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

  5. Give an example of a function.
    prompt(“press any key.”);

  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.
    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?
    A part of the code is only executed if a defined condition is met.

  10. What kind of keyword do you need to use to invoke conditional execution?
    If is the word used to invoke conditional execution.

1 Like
  1. What is an expression?
    a fragment of code that produced a value.
  2. What is a binding?
    a program that keeps an internal state by remembering values in order to use it later.
  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.
    prompt(“private key”);
  6. What is a side effect?
    a dialog box or writing text to a screen is a side effect.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    alert(“thanks for sharing your private key”)
    console.log(Math.max(2,4));
    // 4
    when a function produces a value it is said to return that value
  8. What is control flow?
    Control Flow is a fundamental concept in programming that allows you to dictate how your code runs under different conditions or until a certain condition is met.
  9. What is conditional execution?
    a program that takes some code to be executed if and only if a certain condition is met.
  10. What kind of keyword do you need to use to invoke conditional execution?
    if/else
1 Like
  1. An expression is a piece of code that produces a value
  2. A binding is used to catch or hold values, let, var and const are used to create bindings
  3. The environment is the collection of all bindings that exist and any given time
  4. A function is a piece of program wrapped in a value, it performs a task or produces a value
  5. Number (prompt (“pick a number”));
  6. A side effects of a function can show a dialogue box or writing text to the screen
  7. Function with a side effect alert (“hello world”); with a value console.log (Math.min (10, 20) *2);
  8. The order in which the JS statements are set out, from top to bottom
  9. A condition execution is where a part of code is executed only when certain conditions are met.
  10. You can create this using the if keyword and chain multiple paths / options using the if and else keywords
1 Like
  1. What is an expression?
    A fragment of code that produces a value is called an expression.
  2. What is a binding?
    To catch and hold values, JavaScript provides a thing called a
    binding, or variable.
    The special word (keyword) let indicates
    that this sentence is going to define a binding. It is followed by the name of
    the binding
  3. What is an environment?
    The collection of bindings and their values that exist at a given time is called
    the environment.
  4. What is a function?
    A function is a piece of program wrapped in a value.
  5. Give an example of a function.
    function getNumber (number1, number2){
    return (number1 + number2);
    }
  6. What is a side effect?
    Side Effects are effects that change the internal state of the machine in a way that will affect the statements that come after it.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    function sideEffect {
    A = false;
    }
    function value {
    return _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?
    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.
  10. What kind of keyword do you need to use to invoke conditional execution?
    Conditional execution is created with the if keyword in JavaScript.
1 Like
  1. Every written value is an expression.
  2. A kind of statement to catch and hold a values.
  3. The collection of bindings and their values that exist at a given time is called
    the environment
  4. Function is a piece of program wrapped in a value. Such values can be applied
    in order to run the wrapped program.
  5. console.log
  6. When a statement change something.
  7. console.log produces side effect, Math.max produces value.
  8. Control flow is the order of the executed statements.
  9. Conditional execution is created with the if keyword, to create branching roads of execution order based on the situation at hand.
  10. if
1 Like
  1. What is an expression?

A fragment of code that produces a value

  1. What is a binding?

A binding catches and holds values in Javascript

  1. What is an environment?

The collection of bindings and their values that exist at a given time

  1. What is a function?

A function is a piece of program wrapped in a value

  1. Give an example of a function.

prompt(“Enter Age”);

  1. What is a side effect?

Showing a dialog box or writing text to the screen

  1. Give an example of a function that produces a side effect and another function that produces a value.
  • console.log produces a side affect
  • math.max produces a value
  1. What is control flow?

The order in which the computer executes statements in a script.

  1. What is conditional execution?

A branching road where the program takes the proper branch based on the
situation at hand.

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

If

1 Like
  1. An expression is code that produces a value
  2. A binding is data being linked to a variable to be called at a later time
  3. An environment is the totality of bindings that exist at a given time
  4. A function executes specific preset instructions
  5. function sum(a,b){
    return a+b;
    }
  6. A side effect is the an effect of a function.
  7. A function that produces a text box for input is a function that produces a side effect. A function like the example i gave in question 5 is an example of a function that produces a value.
  8. Control flow is the order in which a program is executed.
  9. A conditional execution is when different lines of code could execute based on what happened previously
  10. if and else statements
1 Like
  1. An expression is a fragment of code
  2. binding is the processing of roping in a value . The book gave the example of “tentacles” around a value .
  3. An environment is a collection of bindings and related values.
  4. A function is a program wrapped to a value .
  5. let “a”=2; let “b”=5
  6. If the statement modifies the state of something unintended
  7. control flow is logic applied to our code
  8. IF Else
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding is a variable.
  3. An environment is 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. An example of a function is a dialog box asking the user for input.
  6. A side effect is the image of the dialog box appearing on the user’s computer screen through a webpage function.
    7.An example of a function that produces a side effect is a dialog box that appears after clicking a button on a webpage. An example of function that produces a value is console.log calculating a mathematical equation and producing a numeral value.
  7. Control Flow is the way the statements within the program occur within the functionality of the program running on the computer.
  8. Conditional Execution is how the statements within the program create a control flow within the program’s functionality.
  9. A keyword you need to use to invole a conditional execution is an if statement.
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding is a variable.
  3. An environment is 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. An example of a function is a dialog box asking the user for input.
  6. A side effect is the image of the dialog box appearing on the user’s computer screen through a webpage function.
  7. An example of a function that produces a side effect is a dialog box that appears after clicking a button on a webpage. An example of function that produces a value is console.log calculating a mathematical equation and producing a numeral value.
  8. Control Flow is the way the statements within the program occur within the functionality of the program running on the computer.
  9. Conditional Execution is how the statements within the program create a control flow within the program’s functionality.
  10. If, if else, while, loop, true/false
1 Like
  1. An expression is a fragment of code that produces an expression.

  2. A binding is what assign’s a variable a value.

3.An environment is collection of bindings and their values at a given time.

  1. a function is a piece of a program wrapped in a value.

5.example of a function console.log( x = 5);

6.A side effect is when a function shows text or a dialog box in the browser when it is invoked.

7.The prompt(enter name); function will produce a dialog box asking for a name.

8.The console.log( " " ) will produce values that you have defined.

9.A control flow is the order your program is executed; From top to bottom without a conditional execution.

  1. A conditional execution is just that. It places conditions on the execution of your program with the keyword IF
1 Like
  1. An expression is a piece of code that evaluates to a value.

  2. A binding is a synonym to a variable. A variable contains a value that can later be changed. It is a placeholder for a value. You have to declare your bindings with the keyword “let” (or “var” or “const”). Any word, except the keywords, can be declared as a binding.

  3. The environment is whatever bindings and values that exist at a certain moment in time.

  4. A function is a set of statements that performs a task or calculates a value. Some are predefined in the environment and some are defined by the user.

  5. The predefined function “prompt()” takes one argument. When you invoke this function it prints a dialog box on the screen with the string you gave as an argument and the user input will be the value that the function returns.

  6. A side effect is any state change (outside the called function) other than its return value.

  7. “prompt()” produces the side effect of a dialog box. “Math.max()” returns a value. The value consists of the greatest number of any amount of number arguments.

  8. The order in which a computer program is executed. In JavaScript the execution order is top to bottom.

  9. Conditional execution splits the top to bottom control flow into two or more different directions depending on whatever conditions that the programmer defines.

  10. “if”

1 Like
  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 mechanism used in Javascript to hold on to a value for short term or long-term subsequent use.

  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.
    console.log(1+2)

  6. What is a side effect?
    A side effect is an “effect” that is produced as a result of an expression. Showing a dialog box or writing text to the screen are examples of a side effect .

  7. Give an example of a function that produces a side effect and another function that produces a value.
    The “alert” function is an example of a function that produces a side effect (the side effect being the dialog box that opens up as a result of the “alert” function.
    The “console.log” is an example of a function that produces a value.

  8. What is control flow?
    Control flow is the top-down direction of the execution of a program.

  9. What is conditional execution?
    A conditional execution is a way for a program to respond based on criteria that are specified in the program.

  10. What kind of keyword do you need to use to invoke conditional execution?
    The “if” keyword is used to invoke conditional execution in a program.

1 Like