Binding, Functions and Control Flow - Reading Assignment

Expression: a code that creates a new value
A binding is a variable that keeps the internal state of a program,it remembers it. See it as an tentacle that grabs and contains info inside.
An environment is a bunch of variabelen and their values
Functions are a lot of values in the browser environment, a piece of program in a value embedded
prompt(enter passcode) or alert(I am Edwin)
An effect of a funktion that give a visible effect,like a box to fill in a password or an argument in text which you can see on your screen

prompt-shows box
the funktion number changes the value to a number

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

Conditional execution= a branching road, only IF a certain condition is fullfilled

if, else, else if

1 Like
  1. “A fragment of code that produces a value is called an expression”

  2. A binding is used to catch and hold values, (not values themselves) helps a program remember things and keeps its internal state by using a “keyword”

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

  1. “A function is a piece of program wrapped in a value” you can call a function by putting parentheses after an expression that produces a function value.

  2. Alert(“hello”)

  3. “Showing a dialog box or writing text to the screen is a side effect”

  4. prompt(“enter passcode”) and console.log(math.max(6,12)

  5. It is the order in which programs are executed (from top to bottom) “as if they are a story”

  6. Means it has to meet certain conditions before a code/program can be executed

  7. A keyword such as “if”

1 Like
  1. An expression is a fragment of code that produces a value.
    Every value that is written literally (such as 22 or “psychoanalysis”) is an expression.
    An expression between parenthesis is also an expression, as is a binary operator applied to two expressions.
    An expression can be content to just produce a value, which can then be used by the enclosing code.

  2. A binding is a piece of code created by JavaScript to catch and hold values. Bindings are also called variables.

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

  5. console.log is a common function provided by most modern JavaScript systems (including all modern browsers and Node.js). This function writes out its arguments to some text output device.

  6. Showing a dialog box or writing text to the screen is a side effect.

  7. alert is a function that produces a side effect.
    console.log is a function that produces a value.

  8. When one’s program contains more than one statement, the statements are executed as if they are a story, from top to bottom.
    That is what we call controle flow.

  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.
    In JavaScript, conditional executions is created with the if keyword.

  10. if

1 Like
  1. An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value. The value may be a number, a string, or a logical value. Conceptually, there are two types of expressions: those that assign a value to a variable, and those that simply have a value.

  2. Binding means to sign a value to a variable.

  3. The data structure that provides that storage space is called an environment.

  4. A function is a block of code designed to perform a particular task.

  5. alert = (“hello world”);
    “hello world”
    alert
    “hello world”

  6. Side effects are mutations or actions that happen in our code environment that we cannot make an account of.

  7. The function alert produces a side effect and the function console.log(2+2); produces a value.

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

  9. Conditional execution controls whether or not some certain code will be executed based of a certain condition being met.

  10. The keyword to invoke conditional execution is IF. ELSE can also be used together with IF to create 2 seperate parallel paths that execution can take.

1 Like
  1. What is an expression?
    A fragment of code that produces a value. If we are comparing code to sentences, an expression is a piece of the sentence, or sub-sentence.

  2. What is a binding?
    A binding is a new value tied to and old value. It is also known as a variable, and it can be defined using “let.”

  3. What is an environment?
    An environment is used to describe the sum of bindings and the values that exist at a given time.

  4. What is a function?
    Functions are values that can be applied to run a part of the program.

  5. Give an example of a function.
    In a browser environment, the prompt binding contains a function that will invoke a dialog box, requiring input.

  6. What is a side effect?
    A side effect is a result of a function other than the return value. In the above example, prompt will print the value, “enter passcode,” but the dialog box requiring input is a side effect.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“Enter passcode”); produces a side effect, and console.log(Math.max(2, 4)); will produce a value.

  8. What is control flow?
    The order in which a program will execute the statements contained in the program.

  9. What is conditional execution?
    A conditional execution is a fork in the program road, and certain conditions will execute and lead the program in one direction vs. the other.

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

1 Like

1 - A fragment of code that produces a value is called an expression. Every value that is written literally is an expression.
2- It is a thing that JavaScript provides in order to catch and hold values.
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- For example, in a browser environment,
the binding prompt holds a function that shows a little dialog box asking for
user input. It is used like this:
prompt("Enter passcode");
image

6- Showing a dialog box or writing text to the screen is a side effect.
7- For example, the function Math.max takes any amount of number
arguments and gives back the greatest.

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 the control flow.

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

10- if statements are used to create that branches.

1 Like

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

2.) What is a binding?
It is something JavaScript provides in order to catch and hold values.

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.
in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input. It is used like this:

prompt(“Enter passcode”);

A prompt dialog

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.
the function console.log(50+75); produces a value while the function alert or prompt(“Enter passcode”); produces a side effect.

8.) What is control flow?
is the order in which your program will execute the statements.

9.) What is conditional execution?
is when 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?
To create a Conditional execution you will need to use the keyword IF

1 Like

1. What is an expression?
An expression is any form of code that results in some form of value

2. What is a binding?
Binding is the process of connecting two sets of data elements together, thus allowing for users to quickly alter data by binding a specific variable to another set of data / statements.

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 piece of program wrapped in a value that can be applied to run the wrapped program.

5. Give an example of a function.
prompt (“enter passcode”);

6. What is a side effect?
a side effect is an output given by an executed function (Ie. a dialog box or writing text on screen) .

7. Give an example of a function that produces a side effect and another function that produces a value.
Value - function add (10 + 10) {
return 10 + 10 ;
}

Side Effect - prompt (“add age”);

8. What is control flow?
The order with which the executions flow through.

9. What is conditional execution?
An executional path that doesn’t necessary follow a one way direction (it can jump straight to end “if” a certain condition is or isn’t met.

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

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

  • What is a binding?
    A value that has been assigned a name.

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

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

  • Give an example of a function.
    Alert

  • What is a side effect?
    A response given by a function - that does not necessarily need to be a value.

  • Give an example of a function that produces a side effect and another function that produces a value.
    Alert - produces side effect.
    Math.min - produces value.

  • What is control flow?
    The queue order in which statements are executed (top to bottom /first to last).

  • What is conditional execution?
    A point in the control flow where depending on the situation a different statement is executed.(next in line).

  • 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. Every value is an expression.
  2. What is a binding?
    Binding is a statement that holds values. Keyword ‘let’ followed by the name and operator and expression define a binding. Binding can be created with keyword var and constant.
  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.
    Math.max(1,2,3,4,5);
  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.
    Var name =prompt(“Enter name:”);
    console.log(name);
  8. What is control flow?
    A control flow shows how statements are executed.
  9. What is conditional execution?
    If we wont some code to be executed only in case a condition is meet
  10. What kind of keyword do you need to use to invoke conditional execution? ‘if’ keyword. if/else
2 Likes
  1. A fragment of code that produces a value

  2. A binding is a way to hold values, it is also called a variable

  3. The environment is the collection of bindings and values.

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

  5. An ex: console.log

  6. A side effect is the effect as a result of a function. Something that will affect the world, either on screen or the statements that come after it.

  7. alert(“Entry Denied”)
    console.log(Math.min(1, 909299287373);

  8. Control flow is the sequence that statements are executed.

  9. Conditional execution allows the program to branch of in a given direction as opposed to a linear control flow.

10.The IF keyword is used to invoke a conditional execution.

2 Likes
  1. What is an expression?
    An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value. The value may be a number, a string, or a logical value. Conceptually, there are two types of expressions: those that assign a value to a variable, and those that simply have a value

  2. What is a binding?
    A binding is a value or string set to a variable, it helps to make bindings so you don’t have to write out the same expression multiple times in the program.

  3. .What is an environment? The environment is the collection of bindings and their values existing in a given instance.

  4. What is a function?
    A piece of program wrapped in a value which can be run by applying it.

  5. Give an example of a function.
    Example: prompt(“Enter passcode”);

  6. What is a side effect?
    A side effect is any output (even printing to the screen) other than the direct result of the program.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    “Showing a dialog box or writing text to the screen is a side effect.”

  8. What is control flow?
    It is the order expressions get executed

  9. What is conditional execution?
    An execution the occurs only under specific circumstances

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

2 Likes
  1. An expression is any fragment of code that produces a value.

  2. A binding is a variable. It captures a value by giving it a name so that the program can remember that value.

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

  4. A function is a piece of program wrapped in a value. A function is called by putting parentheses after an expression that produces a function value. The values between the parentheses are used as input for the program inside the function.

  5. The console.log function takes the input from the parentheses and prints it in the javascript console.

  6. A side effect is any type of output produced by a function such as showing a dialogue box or writing text to the screen. Not all functions have side effects, some just produce values.

  7. The console.log function produces the side effect of writing text to the screen. The Math.max function produces no side effects but it produces the greatest value from any amount of number arguments.

  8. In a program that contains more than one statement, the control flow is the order by which these statements are executed, from top to bottom.

  9. Conditional execution is created with the if keyword. Code is executed only if a certain condition is met.

  10. The if keyword.

2 Likes
  1. An expression is a coded statement which invokes some computation in the program to return a value.

  2. The process of Binding is assigning a value to a variable, which is stored in the program’s memory. This value is assigned and can be invoked using the variable name which was bound to it. Once a value is bound to a variable, the variable can alter it’s value further down the program. The compiler reads a program top-down, and the value assigned to a variable depends on how far down the program has been executed.

  3. The environment of a program is the current memory state of the program. This means the total picture of each of the variables and the values which have been assigned to them. This is the ability to call certain functions depending on what has been stated in the program. The environment is essentially everything in the program that can be called in terms of functions and variables.

  4. A function is an instruction or set of instructions to tell the program what to do. This could be concatenating values, computing a mathematical expression or applying some logic to determine which path the program should follow. An expression will generally return some value or set of values depending on the instructions set out in the function’s code.

  5. An example of a function could be a simple math equation:
    var i = 10;
    function calculateThis(factor1, factor2) {
    return (i + factor1) * factor2;
    }
    In this function, calculateThis takes on two undefined values (factor1 and factor2) to make the calculation possible.

  6. A side effect occurs when a function modifies that state of something else outside of the scope of itself. This means that a variable may change due to the computation of a function, or a certain set of instructions will perform differently because a function has changed the state of the system.

  7. var number = 10;
    function change() {
    return number * 2;
    }
    console.log(change);

  8. Control flow is the order in which a program executes the set of instructions. By default, a JavaScript program will execute from top to bottom. The programmer does however, have the ability to change this by setting particular conditions in which the program will execute in a unique way depending on the current environment of the program.

  9. Conditional Execution provides the programmer with the ability to set conditions to the set of instructions outlined in program depending on the program’s environment. This could be for example, if the program requests the user’s age, and will perform differently whether they are over or under the age of 18. Say the user inputs they are 16, then the program will execute the program with a filter. However if they signal that they are 25, the program will execute without the filter. This could look like:
    if (userAge < 18) {
    return filteredProgram;
    } else {
    return unfilteredProgram;
    }

  10. To invoke some conditional execution, the programmer must utilise an if statement. This is where the program accepts some argument, and if it is true, then it will executes the following set of instructions.
    This is acceptable to be on it’s own where some instruction will execute if the argument is true, and nothing will happen if it is false. There is however a common alternative whereby if the if statement is false, the programmer can set an alternative set of instructions by invoking an else statement. This will be executed when the if argument fails.
    This else can be extended to a list (more than 2) of conditions by the use of else if statements. This happens where the if statement is false, then the program can run through the proceeding else if statements until it finds an argument is true. The argument which is true will execute the code which follows it.

3 Likes
  1. An expression is a piece of code that produces a value.
  2. A binding can be thought of as a kind of “tentacle” that grasps onto a value when defined. The name of a binding can then be used as an expression.
  3. An environment consists of bindings and the values assigned to them that are part of the language standard.
  4. A function is a piece of a program contained or “wrapped” within a value.
  5. function myFunction(p1, p2) {
    return p1 * p2; // The function returns the product of p1 and p2
    }
  6. A side effect occurs when a function does something a little outside of its intended use, although they tend to be quite useful some may have dramatic results.
  7. alert(“Hello, World!”); produces a side-effect by writing text to the screen. console.log
    (Math.max(1, 5978));
    // → 5978
  8. Control Flow simply refers to the way statements are executed from top to bottom like a story book.
  9. Conditional execution typically occurs when using if statements. If one thing happens then this will cause another thing to execute, otherwise the original execution will permit.
  10. if or else
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding uses the keyword “let” to catch and hold values
  3. The environment is the current collection of bindings and their values
  4. A function is a piece of programming wrapped in a value
  5. prompt “enter password”
  6. Showing a dialogue box or text on the screen would be considered a side effect
  7. prompt(“enter password”) - side effect
    console.log(true||true)
  8. Control flow is how your code is deployed, sequentially from top to bottom
  9. Using if to change the flow of your code, depending on what happens prior.
  10. if and else
1 Like

1 - a piece of code that produces a value

2 - binding is a variable the holds a value

3 - environment is the all the binding and their values that exist at a given time

4 - function is a piece of code that produces a value

5 - prompt(“enter name”);

6 - side effects are changes that are either visible output or a change to the state of the machine

7 - side effect: prompt(“enter name”);
no side effect: Max(1,2);

8 - control flow is the path of executive of your program

9 - conditional execution is when a program can take multiple paths depending on what conditions hold

10 - if / else if / else

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

  2. A binding is a thing used in Javascript to catch and hold values so they dont dissipate, they are also called variables. Though keywords “var” and “let” are different in the sense that var is function scoped and let is block scoped, there is also “const” which is a constant binding.

  3. An enviroment 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. Example: console.log

  6. A side effect is basically a change produced by a statement which leaves an impression “in the world”.

  7. Function that produces a side effect: alert(“hello world”);
    Function that produces a value: console.log(Math.max(2, 4));

  8. Control flow is the way all the statements in our program is executed, just like in a story written with human language, it is executed from top to bottom.

  9. Conditional execution is when we want to create a branching road instead of a normal straight one, where the program takes the proper road based on the situation.

  10. The keyword needed to invoke a conditional execution is: if .

1 Like

1.- it is a fragment of code that produces a value.
2.- When a value is binded to be used as an expression
3.- It is the collection of binds and their values that exist at a certain time.
4.- It is a piece of program wrapped in a value.
5.- prompt (“invoking”);
6.- It is the dialog box or writing text on the screen (The usefulness of a function)
7.- var a=2; var b=3; console.log (a+b); - prompt (“calling”);
8.- Is the process of how more than one statement is executed.
9.- It is how a program can have two ways to be executed based on the situation at hand.
10. “if”

1 Like

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

Bindings catch and hold values so we can use them later. Their value can be reassigned at any time, and they are also known as variables.

An environment is essentially the current collection of bindings and values.

A function is a piece of code; a fragment of a program that performs a specific task.

console.log, prompt. A function is typically written like this:
expression(argument1,argument2)

A side effect is a meaningful change in the world that is produced by a statement, or function.

An example of a function that produces a side effect is prompt (which creates a text input box). An example of a function that produces a value would be Math.max or Math.min

Control flow is referring to how a program is read from top to bottom. So, things that are written in the first parts of the code “flow” into the subsequent parts (using variables).

Conditional execution can be thought of as a fork in the road of a code. This enables a program to make decisions and act based on different inputted data.

“IF” is the magic word that invokes conditional execution.

1 Like