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?
giving a name to a value
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?
function is a piece of program wrapped in a value
5. Give an example of a function.
alert (“Hellow”);
6. What is a side effect?
A side effect is any application state change that is observable outside the called function other than its return value.
7. Give an example of a function that produces a side effect and another function that produces a value.
console.log (“hi”); (Math.max(2, 4));
8. What is control flow?
the statements are executed from top to bottom
9. What is conditional execution?
Branching the control flow of a program based on a specific condition represents a conditional execution
10.What kind of keyword do you need to use to invoke conditional execution?
(if, else, else if )

1 Like
  1. What is an expression?
    • A fragment of code that produces a value is called an expression
  2. What is a binding?
    • Catch and hold values in Javascript
  3. What is an environment?
    • The collection of bindings and their values that exist at a given time
  4. What is a function?
    • Piece of program wrapped in a value
    • Such values can be applied in order to run the wrapped program
  5. Give an example of a function.
    • The binding prompt holds a function
      • Shows a dialog box asking user for input
        • E.g. prompt(“Enter Passord”)
          • Enter password ____________
    • Executing a function
      • Invoking
      • Calling
      • Applying
  6. What is a side effect?
    • When a function
      • Shows a dialog box
      • Writes text to the screen
  7. Give an example of a function that produces a side effect and another function that produces a value.
    • alert(“Hello World”) - side effect
    • Console.log(Math.max(2, 4)) - Value
  8. What is control flow?
    • When a program contains more the one statement, they are executed top to bottom
  9. What is conditional execution?
    • Not all programs execute along a defined path
      • They can branch off along a different path based on the conditions that came before
  10. 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?
    Bindings are words which are assigned and hold values.
  3. What is an environment?
    It is the collection of bindings and values at any given time.
  4. What is a function?
    A piece of programm wrapped in a value.
  5. Give an example of a function.
    prompt is a function which once applied shows the user of a webbrowser a dialog box asking for an input, like a password etc.
  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(“Enter passcode”);
  8. What is control flow?
    Statements inside a programm are executed from top to bottom.
  9. What is conditional execution?
    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
    -with the keyword else you can define what is to happen if the conditions aren´t met.
1 Like
  1. What is an expression?
    A fragment or piece of code that generates a value is an expression.

  2. What is a binding?
    A binding allows for javascript to catch and hold values for later use as it is currently defined. The binding can also be redefined to another value at any time. I.E variables.

  3. What is an environment?
    It is the collection of bindings and their values within a program.

  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) is a program that displays a dialog box whenever it is keyed in. Prompt is the function while the expression inside the parentheses will display on the dialog box.

  6. What is a side effect?
    A side effect is something like a dialog box or written text on the screen. These are produced by functions.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Prompt(insert) produces a dialog box vs. console.log(math.max) produces a value.

  8. What is control flow?
    It is the reading of statements from top to bottom in a program.

  9. What is conditional execution?
    The program will execute only certain code based on the conditions that are met from the user inputs.

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

1 Like

1.Expression is a fragment of a code that produces a value.
2.Binding is sorts a string that is attached to a value so it can retrieve it later if needed.
3. Environment is a collection of bindings and their values.
4. Function is a piece of program that wrapped in a value.
5.Example of a function: prompt (“enter a passcode”);
6. Side effect happens when one function changes all statements followed after.
7. Example of a function that produces a side effect :
prompt("…");
and another function that produces a value:
console.log(math.max(…));
8. Control flow is the order in which the code is written and the order in which the program is executed.
9. Conditional execution is a branching way building a program. If A happens you get one result, if B happens the result is different.
10. The keyword is IF.

1 Like
  1. A fragment of code that produces a value is called an expression.
  2. They do not contain values; they grasp them—two bindings can refer to the same value.
  3. The collection of bindings and their values that exist at a given time is called
    the environment
  4. In a browser, there are functions to interact with the
    currently loaded website and to read mouse and keyboard input.
  5. It’s applying a coded action i.e. asking the user to interact (promtp (“Enter Passcode”);
  6. the box appearing and asking for an action is a “side effect”
    • prompt(“Enter passcode”); has the side effect of a prompting dialogue box. Console.log(Math.max(2, 4)); produces no side effect, though produces a value.
  7. the order in which we code, same as humans reading a book.
    1. Conditional execution means that some part of the code is going to be executed only if certain condition
      is fulfilled( true ).
  8. if, else
1 Like

1. What is an expression?
- An expression is a value that is generated by a fragment or a piece of code.
2. What is a binding?
- A binding allows JavaScript to catch and hold values for later use as it is currently defined.
- Can be redefined to another value at any time.
○ variables.
3. What is an environment?
- A collection of bindings and their values within a program.
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?
- If a statement or function modifies the state of something else (outside its own scope), then it is
producing a side effect.
7. Give an example of a function that produces a side effect and another function that produces a value.
- prompt(“Enter name”)
○ produces a dialog box as a side effect asking to enter a name
- console.log(Math.max(2, 1));
○ produces a value // → 2
8. What is control flow?
- the reading of statements from top to bottom in a program.
9. What is conditional execution?
- The program will execute only code based on conditions given by user inputs.
10. What kind of keyword do you need to use to invoke conditional execution?
- IF

1 Like
  1. Unit of code that can be produce value. (1+2=)
  2. Binding stores value and it is used when a function is called.
  3. It’s a data structure that provides storage space.
  4. Function is a command from code that creates and operation.
  5. Function is a statement that executes a task.
    Alert(“I need a new job”)
  6. It prompts the message
  7. console.log produces side effect and Math.max produces a value.
  8. The flow of code from top to bottom.
  9. Conditional execution is controlled by if statements.
  10. Else statement.
1 Like
  1. What is an expression?
    A fragment of code that produces a value is called an expression.
  2. What is a binding?
    It helps programmer to catch and hold values.
    Aka variables
  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. Such values can be applied in order to run the wrapped program.
  5. Give an example of a function.
    prompt. It shoes a little dialog box asking for user input.
  6. What is a side effect?
    If a statement or function modifies the state of something else (outside its own scope), then it is
    producing a side effect.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt
  8. What is control flow?
    Executing program from top to bottom.
  9. What is conditional execution?
    Creating a branching road where the program takes the proper branch based on the situation at hand.
  10. What kind of keyword do you need to use to invoke conditional execution?
    If
1 Like
  1. An expression is a piece of code that produces a value.
  2. Binding makes an association between two or more objects.
  3. Environment is a collection of bindings and their values.
  4. Functions are pieces of programs wrapped in values. A set of instructions.
  5. alert, prompt, let.
  6. Side effects are the results of functions.
  7. alert “hello world”; side effect. let x = 2 would be a value.
  8. Control flow is the process of a program executing two or more statments.
  9. Conditional execution = program will execute only if conditions are met.
  10. “if”
1 Like

What is an expression?

Its a code snippet/ a statement that evaluates to a value. It performs an actions and return a value to us. Anything that produces a value is an expression in JavaScript.

What is a binding?

Binding is another name of variables. It catches and values for us. We can use it whenever we need it to use. It has scopes so, if any binding is scoped inside a function you cant use it outside of that function. Global bindings can be used anywhere in the program.

What is an environment?

Environment is a data structure that provides storage space to the program execution enters their scope. It maps variable names to values that’s how variables comes into existence.

What is a function?

A function is a piece of program that contains a set of statements that performs a task or calculates a
value.

Give an example of a function.

function myFunction (number){
return number * number;
}
-----> This function performs multiplication and return the result when its being called with an argument.

What is a side effect?

Showing a dialog box or writing a 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.

alert(“Hello World”);

console.log(Math.max(2,4) + 20);
// --> 24

What is control flow?

Control flow is the order in which individual statements, instructions, function calls are evaluated or
executed.

What is conditional execution?

Specifically, conditionals perform different computations or actions depending on whether a programmer-defined Boolean condition evaluates to true or false.

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

  1. if…else
  2. While and do loops
  3. For loops
1 Like
  1. An expression is a fragment of code that produces a value.

  2. Bindings keeps an internal state and remember things.
    They produce new values from old values. The old value
    is not changed though. And the new one must be used immediately
    or else it will dissipate.

  3. The environment is the data structure that provides storage space.

  4. Program that is wrapped in a value is function. Functions
    are applied to run the wrapped program.

  5. function ShowMessage ()
    }
    ShowMessage ();

  6. Side effects result in a change. They set or modify
    the value of a variable through the assignment operator.

  7. Side effect: function plusWithSideEffects (x,y)
    {
    alert (“This is a side effect”);
    return x + y;
    Value: function; function square(number) {
    return number * number
    }

  8. Control flow controls statements from top to bottom.
    That is, when a program contains more than one statement.

  9. Conditional execution is a branching road. The program
    takes the proper branch based on the situation at hand.

  10. if is the keyword used in Javascript for Conditional
    Execution, “if Block”.

1 Like

1. What is an expression?
An expression is any value written.

2. What is a binding?
A binding is creating a reference or a hold on to a value from some expression.

3. What is an environment?
The collection of values and bindings that are present in the program.

4. What is a function?
A function is a piece of program that is wrapped in a value; functions cause changes in the system and get complete actions.

5. Give an example of a function.

let black = 25, white = 20;
console.log(Math.max (black, white));
//-> 25

6. What is a side effect?
Side effects produce an external change visible to the user (like dialogue box or prompt).

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

alert(“Enter if you dare.”);

Producing Value

console.log( Math.min(100,99.9));

8. What is control flow?
The process by which a program is executed, from top to bottom.

9. What is conditional execution?
A program that can take different paths depending on the inputs it receives.

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

1 Like

1.) A piece of code that produces a value
2.) A variable that holds catches and holds values
3.) The list of Bindings and the values at a given time
4.) Piece of program wrapped in a value
5.) prompt(“Enter username”);
6.) Displaying a dialog box
7.) alert(“helloworld”); / console.log(Math.max(10,25));
// = 25
8.) When a program has more than one statement
9.) if

1 Like
  1. It’s simply a part of a code that creates a ‘value’. For example, 1+1 = 2. The expression here would be ‘1+1’ and the value is ‘2’. An expression within parentheses is also an expression e.g. (2+3). Moreover, an expression can be content that produces a value.

  2. A binding (i.e. variable) is a named value. It simply stores data(value) and gives it a name so that we can use it later on.

  3. It’s where your named values i.e. bindings are kept at a given time.

  4. It’s a part of a program which is named and executes certain tasks.

  5. prompt(“Enter passcode”)

  6. A side effect is when a function depends on, or makes changes to something outside its variables to do something. For example, a function which reads or writes from a variable outside its own values , data, or console can be said to have side effects. Showing a dialog box or writing text to the screen is a side effect.

  7. prompt(“Enter passcode”) is clearly a side effect as it shows a dialog box.
    console.log(Math.max(2, 4)) creates a value.

  8. It’s just the way we structure and order our coding language, as well as evaluate our statements.

  9. when we want to execute some of a code only if a specific condition is met. E.g. we want to find the square of the input data only if it is actually a number.

  10. One example would be ‘if’.

1 Like
  1. A piece of code that produces a value.
  2. A binding is similar to a variable, it is something that attaches to a value to keep it stored.
  3. The collection of bindings and their values that exist at a given time.
  4. A set of statements that seeks to perform a task.
  5. function add(num1, num2)
  6. Something that happens as a result of a function that is apparent to the user.
  7. a)alert(“helloworld”);
    7.b) console.log(Math.min(10, 66));
  8. The ability to have a program move in the expected direction based on the code.
  9. It is a condition in which the program will search for the branch in the road where the condition holds true and will execute upon that.
  10. the “if” keyword
1 Like

1_ An expression is a fragment of code that produces a value
2_ Binding is a tool allowing to catch and hold values
3_ The environment is a collection of bindings and their values that exist at a given time
4_ A function is a piece o fprogram wrapped in a value
5_ Math.max (num1, num2, num3)
6_A side effect is a result of functions, that appear on the user program interface
7_ prompt (“what is your Name?”); console.log(“mon”+“dad”+“kid” = “family”)
8_ Control flow is a set of tools allowing to control the sequence of encoded operations
9_Conditional execution is an expression or statement allowing to output values depending on a number of conditions set
10_“if”

1 Like
  1. A fragment of code that produces a value.
  2. The same thing as a variable. Something that holds a value of some sort.
  3. The collection of bindings and their value at a given time.
  4. A piece of program wrapped in a value.
  5. consol.log
  6. Showing a dialog box or written text on the screen.
    7.promt and math.min
  7. Code is interpreted in the order it comes in the program. From top to bottom.
  8. Multiple options for the program to execute.
  9. The keyword if.
2 Likes

What is an expression?

  • A fragment of code that produces a value.

What is a binding?

  • In effect is also a variable, used to refer to values.

What is an environment?

  • Collection of bindings and their values that exist at a given time.

What is a function?

  • A function is a piece of a program wrapped in a value

Give an example of a function.

  • alert() function

What is a side effect?

  • A change of internal state in the machine or an output produced in the GUI after invoking a function.

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

  • alert(), Math.min()

What is control flow?

  • The sequence of when statements of a program is executed.

What is conditional execution?

  • Conditional execution means executing a statement/s only if a certain condition is met.

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

  • One uses the ‘if’ and or ‘else’ keywords
1 Like

1.a fragment of code that produces a value is called an expression.

2.binding is used to catch and hold 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.

5.prompt (enter password)
Prompt (enteryourname)

6.showing a dialogue box or writing text to the screen is a side effect.

7.prompt (“enterpassword”) side effect dialougue box
Console.log(math.max)(2,4)) gives a value

8.the order in which the program reads the coding when there is more than one statement from top to bottom is control flow.

9.when a program is not in a straight line and beaches off the program will execute the right path based on the situation at hand given the if function.

  1. If function
1 Like