Binding, Functions and Control Flow - Reading Assignment

  1. What is an expression?
    An expression is a piece of code that gives an outcome or value.

  2. What is a binding?
    A binding or variable is is an variable that is bound to an expression.

  3. What is an environment?
    A collection of bindings that exist at any given time is called an environment.

4.What is a function?
A function is programming that is wrapped in a value.

  1. Give an example of a function.
    prompt(“Enter passcode”)

6.What is a side effect?
A side effect of a function is when something else is produced in place of a return value.

  1. Give an example of a function that produces a side effect and another function that produces a value.
    An alert is a good example of a side effect being produced instead of a return value.

  2. What is control flow?
    Execution flows from one part of a program to the next, this is called control flow.

  3. What is conditional execution?
    A condition execution is where some parts of the code are only executed if certain conditions are met.

  4. What kind of keyword do you need to use to invoke conditional execution?
    Loop, If and else.

1 Like
  1. What is an expression?
    An expression is a piece of program that enables a value.
  2. What is a binding?
    A binding is the link between a value and a representation.
  3. What is an environment?
    An environment the total seg of binding given to a program.
  4. What is a function?
    A function is Alice of code that can execute an action.
  5. Give an example of a function.
    Tjis is an example of an function: alert(“alert is a funtion”);
  6. What is a side effect?
    A side effect is a value/ notification displayed in the monitor as a notification box.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    alert(“this a side effect”)
    var hi = (“high, I mean hi”)
  8. What is control flow?
    The work flow is the sequence in which a program runs: top to bottom: left to right.
  9. What is conditional execution?
    A conditional execution is function running under the condition of multiple possible outcomes.
  10. What kind of keyword do you need to use to invoke conditional execution?
    The keyword “if” can be used to invoke a conditional function.
1 Like
  1. A fragment of code that produces a value.
  2. It is a statement that can catch and hold values.
  3. It is 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. prompt(“How are you feeling today?”)
  6. It is a by-product of a certain function (for example showing a dialog box or writing text to the screen).
  7. side effect = prompt; value = Math.max/Math.min
  8. It is the order in which the code and statements are being evaluated.
  9. It is a way to enable the program to evaluate and run the proper code based on the situation at hand.
  10. 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?
    Catching and holding values within variables.

  3. What is an environment?
    Collection of bindings and their values that exist at a given time.

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

  5. Give an example of a function.
    prompt - a binding that holds a function that shows a dialog box asking for input.

  6. What is a side effect?
    When statements change the internal state of the machine in a way that it’d affect the statements that come after it. Or something that affects the world, e.g. 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.
    prompt is a side-effect and Math.max returns a value.

  8. What is control flow?
    Program consisting of multiple statements executed from top to bottom like a story.

  9. What is conditional execution?
    Branching road of the execution flow based on a condition (boolean expression).

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

2 Likes

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

2 - A binding is a variable that grasps a value.

3 - The environment is the collection of bindings and their values that exist in a give time.

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

5 - An example of function is the prompt , it uses the string that we give is as a text and it shows it in a dialog box.

6 - A side effect is a change of the internal state of the machine in a way that will affect the statement that come after it.

7 - A function that produces a side effect is the prompt function, a function that produces a value is the Math.max function.

8 - Control flow is the way we organise the program depending of the results we want to achieve, we may have a straight for or a multi path flow when the direction depends on the variables.

9 - Conditional execution is where the program takes the proper branch based on the situation at hand.

10-We need if and, but not always necessary, else .

1 Like

1: A fragment of code that produces a value.

2: A letter or word that has been set to be a variable.

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.

5: x=prompt(“please insert number”); this function sets variable x to a number, which will be entered by the user.

6: A side effect is any application state change that is observable outside the called function other than its return value.

7: Alert is an example of a side effect function because it creates a prompt window and Math.min is an example of a function which creates a value.

8: When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.

9: When a program is written in a way that the outcome can have more than one possibility.

10: You would need the word/command "if"or “else”.

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

  2. What is a binding?
    Binding holds together values like variables

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

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

  5. Give an example of a function.
    console.log

  6. What is a side effect?
    When a function executes and produces some specific result eg. outputting text to the screen.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt( “How old are you?”)
    console.log(2+3*2)

  8. What is control flow?
    The order in which a code is processed

  9. What is conditional execution?
    Execution of a piece of code that requires a condition to be met

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

1 Like
  • What is an expression?

it is a fragment of code that produces a value.

  • What is a binding?

Is like a link to a value. like var or let.

  • What is an environment?

everything that has a binding to it.

  • What is a function?

It is a set of commands that produce an output.

  • Give an example of a function.

console.log

  • What is a side effect?

it is when a function produces an output that changes the program.

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

a function that gives a side effect would be when you asigne a value to a word and then ask to change that value. (alert function)
a function that gives a value would be a mathematical operation like adding or multipliying. (1+2)

  • What is control flow?

when there is more than one statement( words that are assigned a value) and the function changes the values from left to right, like reading a book.

  • What is conditional execution?

When the execution to be done there is a series of conditions to be met and depending on the condition it will execute one way or the other.

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

if and else

1 Like

What is an expression?

Quoting directly, “A fragment of code that produces a value is called an expression”

What is a binding?

Binding is the relationship between a name and a value in javascript

What is an environment?

Environment is the collection of bindings and values in the current session or page

What is a function?

a Function is a piece of program wrapped in a value (quoting direclty)

Give an example of a function.

console.log() or prompt()

What is a side effect?

It is when a program or function modifies something outside its scope or design, such as outputting the the console in addition to executing its definition.

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

prompt(“hello”) has the side effect of outputting on the console

What is control flow?

Control flow is the order of statements executed in a program, it can be modified from sequential using logical branching and / or looping structures.

What is conditional execution?

It is a logical test that determines which path to follow if the test is true, or an alternative path if it is false.

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

IF and ELSE keywords and its variations.

1 Like

Binding, Function and Control Flow - Reading.

  1. An expression is a fragment of code that produces value eg.
    220 or (“psychoanalysis”);

  2. Binding() method allows us to easily set which object will be bound by the keyword when a function or method is invoked. It catches and holds values.
    For example:

  • let ten = 10
  • console.log(ten * ten);
  1. The environment is the collection of binding values that exist at a given time.

  2. A function is a piece of program wrapped in a value, such value can be applied in order to run the wrapped program.

  3. Example of a function.
    prompt(“Enter Passcode”);

  4. Side Effect is any application that is observable outside the called function other than it return value, eg. showing a dialogue box or wrting a text to a screen.

  5. Example of function that produces side effect.

  • console.log(Maths.max(2,4);
  1. Control flow is the order that the instructions, statements or functions are executed (from top to bottom).

  2. Conditional Execution is where a program takes a proper branch based on the situation at hand.

  3. The keywords you need to use to invoke conditional execution are:

  • if
  • only if
    eg. show the square root of the input only if input actually a number.
1 Like

A fragment of code that produces a value.

binding is a way a program keeps his internal state. bindings can store values that we can use later on.
Binding is a variable

Collection of all binding and their values that excit at a certain timestamp is called the enviroment.

a function is an expression wrapped in a value that performs a specifik task to that value.

alert(“i am nolles”);

If a statement or function modifies the state of something else outside its own scope that we call that a side effect like showing a dialog box is a side effect

Side effect:
prompt(“enter pasword”);

Value:
console.log(Math.min(2, 4) + 100);
// → 102

When your program contains more than one statement, the statements are
executed as if they are a story, from top to bottom.

not all programs are straight roads, sometimes u have to make several roads depending on the certain output value’s for this we use the If function.

if and else

1 Like
  1. expression - a fragment of code that produces a value
  2. binding - used to catch or hold values
  3. environment - when a program starts up there exists a collection of bindings and their values
  4. function - a piece of program wrapped in a value, applied in order to run program
  5. example - console.log
  6. side effect - statements that can change the internal state of the machien and the statements that follow
  7. example of side efffect - dialogue box or writing text to screen; example of value

console.log(Math.max(2, 4));
// → 4
8. Control flow - is the direction that a program is executed, like a story, from top to bottom
9. conditional execution - The code will be executed if it meets a specified condtion, it produces branches in the code
10. if and else keywords are used

1 Like
  1. A fragment of code
  2. To catch and hold values, JavaScript provides a thing called binding
  3. The collection of bindings and their values
    4.The collection of bindings and their values
  4. prompt(“Enter passcode”);
  5. side effects may change the way application acts
  6. prompt(“Enter passcode”);prompt(“Enter passcode”); prompts you for passcode
    console.log(Math.max(6, 4)); give output of 6
  7. the way the program flows from top to bottom
    9 We may, for example, want to create
    a branching road, where the program takes the proper branch based on the
    situation at hand.
  8. If – it is keyword to invoke Conditional Execution
1 Like
  1. A piece of code that creates a value is called an expression.
    2 Binding it’s an ability to assign value and create variables
  2. Combination of variables and their values that exists and any given time is called the environment.
    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
  3. console.log(Math.min(2 , 4));
    // - 2
    console.log(Math.max(2, 4) +100);
    // - 104
    8.Control flow is a sequence of executing a program from top to bottom.
  4. A program can be executed with no linear command but rather take the proper branch based on the situation at hand.
  5. if
1 Like
  1. What is an expression?
    It is a fragment of code that produces a value.

  2. What is a binding?
    It´s a thing to catch and hold values,

  3. What is an environment?
    It 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.
    prompt (“This is a function”)

  6. What is a side effect?
    It is to show 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 (“Show a box”)
    math.max(7,5)

  8. What is control flow?
    It´s the execution of a program from top to bottom when it has more than one statement.

  9. What is conditional execution?
    It´s when a 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 and else.

1 Like
  1. Every value that is written literally, whether it is a number or string.
  2. Binding is using a variable, or let command to assign a value to a symbol
  3. An enviroment is the collection of bindings and their values.
  4. A function is something in JavaScript that takes an Expression and performs an operation on it.
  5. An example could be the prompt function, which asks for user input into the site.
  6. A side effect is some dialog or written text that can appear in the function
  7. A function that could produce a side effect is the console.log function that is told to print string values. A function that produces a value could be the Math.max function, where it determines the max of the values.
  8. The control flow is the way and order that code is written in.
  9. Conditional execution is a way to create mutiple paths based on what is happening to input values in the code.
  10. The keywords needed to invoke a conditional execution are "if’ or “while”
1 Like
  1. What is an expression?
    A fragment of code that produces value.
  2. What is a binding?
    It initializes and holds a value for a certain variable.
  3. What is an environment?
    It is the collection of bindings and their 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.
    prompt()
  6. What is a side effect?
    Side effect is a change that happens in the internal state of the machine that affects subsequent statements, such as showing a dialogue 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() produces a side effect and Math.max() produces a value.
  8. What is control flow?
    It is the order of top to bottom execution of the statements in the code.
  9. What is conditional execution?
    Conditional execution requires a certain input condition to determine which approach is to be used.
  10. What kind of keyword do you need to use to invoke conditional execution?
    if, while
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding is used to catch and hold values and is defined by the keyword let
  3. An environment is 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. prompt(“Please enter your name”
  6. A side effect is showing a dialog box or writing text.
  7. Example of function producing a side effect: ```
    function plusWithSideEffects(x, y) { alert(“This is a side effect”); return x + y; }
Example of a function that produces a value; console.log(Math.max(2, 4));
// 4
8. Control flow is when a program contains more that one statement, they are executed as if they were a story, from top to bottom.
9. Conditional exclusion is when a program takes a proper branch or path based on the situation at hand. 
10. The if keyword is used to invoke a conditional execution.
1 Like
  1. A fragment of code that produces a value
  2. To chatch and hold values, retains a value associated with a variable
  3. The collection of bindings and their values that exist at a given time is calledtheenvironment.
  4. A function is a piece of program wrapped in a value.
  5. prompt(“Enter passcode”);
  6. produced by functions, a helpful byproduct such as writing text to screen, showing a dialog box, or producing a value
  7. prompt(“Enter passcode”); & console.log(Math.max(2, 4));
  8. Statements within a program are executed from Top to Bottom
  9. a branching execution through a script based on the situation at hand
    10 A reserved keyword
1 Like

What is an expression?

A fragment of code that produces a value (e.g. literally written values, an expression between parenthesis, or a binary operator applied to two expressions or a unary operator applied to one); if an expression corresponds to a sentence fragment, a Java Script statement corresponds to a full sentence. A program is a list of statements. A statement stands on its own and if it has an effect on the world this is called side effects.

What is a binding?

It’s a statement that allows to catch and hold values; it’s interchangeable with the word ‘variable’. ‘Let’ indicates that it’s defining a binding, followed by the name of the binding, a ‘=’ and an expression.

Bindings grasp values, they don’t contain them (it’s possible to change them again);

A single let statement may define multiple bindings that must be separated by commas;

‘Const’ creates a constant binding which stays the same as long as it lives

What is an environment?

It’s the collection of bindings and their values that exist at a given time. The environment is never empty as there are a few standard language bindings.

What is a function?

It’s a piece of program wrapped in a value, they can be applied in order to run the wrapped program. (e.g. ‘prompt’). You can invoke, call or apply a function. Values that are given to a function are called arguments.

What is a side effect?

Showing a dialog box or writing text to the screen is a side effect. In contrast, functions that only produce values don’t need a side effect to be useful.

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

Side effect function: prompt()

Value function: math.max()

What is control flow?

It’s the way your program runs through your statements from top to bottom.

What is conditional execution?

The situation when a program doesn’t simply run from top to bottom, but in between it chooses a path depending on the situation at hand.

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

The if keyword

1 Like