Binding, Functions and Control Flow - Reading Assignment

1: A fragment of code that produces a value.
2: Catches and holds values, much like a tentacle.
3: An environment is the collection of bindings and values that exist at a given time.
4: A piece of of program wrapped in a value.
5:Prompt (“Enter passcode”).
6. That which changes the internal state of a machine and the statements that come after.
7: console.log(Math.max(2, 4));
// → 4 ; console.log(Math.min(2, 4) + 100);
// → 102
8. When a program contains more than 1 statement, it is executed from top to bottom.
9: A branching road that the program takes depending on the situation at the moment.
10. If

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, else, if and only if, while, and do

1 Like
  1. An expression is a piece of code that produces a value.
  2. A binding is another word for variable. Bindings store values.
  3. An environment is the collection of variables and their values at a given time.
  4. A function is a piece of code wrapped in a value.
  5. alert(“Hello”);
  6. A side effect is any observable change to the application outside a called function other than the functions return value…
  7. side effect:
    prompt(“Hello”);
    value:
    console.log(Math.max(5,8);
  8. Control flow is the order in which the pieces of a program are run.
  9. Conditional execution is when a program may execute differently based on a value.
  10. The keyword ‘If’ invokes a conditional statement.
2 Likes
  1. An expression is the name of the code defining a value ie 2+2

  2. Bindings are open references to values. They are not containing values and can be changed whenever.

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

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

  5. function myFunction(p1, p2) {
    return p1 * p2;
    }

  6. Side effects return something other than a value, such as dialog box, text on screen etc.

  7. Side effect; prompt(“Enter passcode”);
    Value; function myFunction(p1, p2) {
    return p1 * p2;
    }

  8. The order in which your program’s statements are executed, typically top to bottom.

  9. Completes statements based on previous values, like a branch different statements to be executed based on pre-defined conditions

  10. IF

1 Like
  1. What is an expression?
  • An expression is a fragment of code that produces a value.
  1. What is a binding?
  • A binding is used to catch or hold a value by using “Let”.
  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?
  • A function is a piece of program wrapped in a value.
  1. Give an example of a function.
  • alert(“Hello World”);
  1. What is a side effect?
  • Side effect is 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.
  • alert(“This is a side effect”);
  • console.log(1+1);
  1. What is control flow?
  • The order in which the commands are executed which is from top to bottom and left to right.
  1. What is conditional execution?
  • A way to skip certain lines of command if conditions are not met.
  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, every value that is written is an expression. An expression between parentheses is also an expression, etc.

  1. What is a binding?

bindigns, such as (let) assign values. This does not mean that if you assign vales that they are going to be held forever, you can always change the value of an expression with an operator (=) again. Or you can change the volume of the value with other operators such as (+,-,*,/ etc.)

You can use (var,const) similar to (let)

  1. What is an environment?

The collection of bindings and their values that exist at a given time is called the environment. Bindings which provide ways to interact with the surrounding system also count.

  1. What is a function?

Functions are a type of value which is a piece of a program, wrapped in values. Executing a function is called invoking, calling or applying. Values given to functions are called arguments.

  1. 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.

  1. What is a side effect?

A lot of functions are useful because of te side effects they produce, such as in the example above with the little dialog box appearing. This dialog box is the side effect. Naturally this isn’t the only side effects functions can have.

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

a) prompt(“Enter passcode”)

b) console.log(Math.max(2, 4))

  1. What is control flow?

When a program has more than one statement, the statements are executed in a specific order: left to right, top to bottom. But there are exemptions.

  1. What is conditional execution?

If you want a program to do something else than what it would do originally if something specific happens, or a specific value comes out, etc. it is called a conditional execution. If that happens do that, if this happens do this, etc.

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

(if)

2 Likes

1 - expression is a series of variables, operators, and method calls that evaluates to a single value

2 - Binding is an association of method call to the method definition

3 - An Environment variable is a dynamic “object” on a computer that stores a value, which can be referenced by one or more software programs

4 - A function is a reusable portion of a program, sometimes called a procedure or subroutine

5 -
z=1
1
w=2
2
r=z+w
3
6 - A side effect is the modification of state through the invocation of a function or expression

7 - Function that produces a value.:
function increment(number) {
return number + 1;
}
Function that produces side effect…
alert(" Function that produces side effect")

8 - Control flow is the order in which instructions, statements and function calls being executed or evaluated when a program is running.

9 - The if / else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed.

10 - if or/and Else

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

2.binging is a form of catching and holding a value.

  1. an environment is when binding and values exist together.

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

  3. function Countdogs (bobdogs,samsdogs) { return bobdogs+samsdogs}
    Countdogs (5,3)

  4. A side effect is a useless program.

  5. 1; let dog=1:
    !false;

8When the program executes statements like story’s.

  1. When the program takes the proper branch based on the task in hand.

10.if

1 Like

1). A piece of code that produces a value is called an expression.

2). A binding is computer memory that keeps the information inside.

3). The collection of variables and their values that exist at a given time is called the Environment.

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

5). alert(“LET"S GO BRANDON! is number 1 right now in America. Thank you Loza Alexander!”)

6). A side effect is anything that could change the internal state of the program in a way that will affect the statements that come after it.

7). var ten = 10
ten * ten;
→10

8). Control flow is the way in which we want our code to be executed.

9). Conditional execution: Sometimes we do not want all the statements in our program to always be executed in the same order.

10). if is the key word we can use to invoke conditional execution.

1 Like
  1. Code that produces a value
  2. Tethering a value to a (re-usable) name
  3. Collection of bindings and their values that exist in a program
  4. A piece of program that is ‘called’
  5. console.log(“I’m a function!”);
  6. A statement of code that has the result of impacting code that comes after it
  7. Using function “if”
    sum
  8. The “story” of the program
  9. using “if” “else” functions
  10. “if”
1 Like
  1. ***What is an expression? Is a fragment of code that produces a value, is an expression.
  2. What is a binding? Keywords that tell the program remember this.
  3. What is an environment? Collection of bindings and it values using ()
  4. What is a function? Tell the program to do something
  5. Give an example of a function. prompt(“Say Hello”)
  6. What is a side effect? A side effect is the result of a function. That doesnt just produce a value. It takes in outside factors to return various outcomes maybe depending on user input
  7. Give an example of a function that produces a side effect and another function that produces a value.
    X=(3*2)
    6
    X
    6 this produces a value

A side effect would be
prompt(“enter username”)

  1. What is control flow? Is the steps each function takes to eventually reach its desired result.
  2. What is conditional execution? This only happens if That is done first.
  3. What kind of keyword do you need to use to invoke conditional execution? Else
1 Like
  1. Expressions are fragments of code that produces a value.
  2. A binding is a statement, that catches or holds a value.
  3. An environment is a collection of bindings and their values at that moment.
  4. A function is a piece of code wrapped in a value.
  5. Console.log
  6. A side effect is the output of the result of a function.
  7. Console.log produces a side effect. Math.max produces a value.
  8. Control Flow is the direction in which the code is executed.
  9. Conditional execution is whereby certain conditions have to be met in order to execute a code. This creates a branch where the condition state determines which direction to take.
  10. This is done using the If keyword.
1 Like
  1. What is an expression?
    It is a fragment of code that produces a Value.

  2. What is a binding?
    It is a way to store values that can be used later. You use the “let” statement to define one or more bindings. You can define a specific value to a binding, so everytime you use that binding, the value you applied to it before, will display and be used by the code.

  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 lot of the values provided in the default environment have the type function.
    A function is a piece of program wrapped in a value.
    Executing a function is called invoking, calling, or applying it. You can
    call a function by putting parentheses after an expression that produces a
    function value.

  5. Give an example of a function.
    alert (“hello world”)

  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.
    Produces a value=
    “the function Math.max takes any amount of number
    arguments and gives back the greatest.” —> console.log(Math.max(2, 4)); —> // → 4
    Produces a Side effect= prompt (“How’s it going?”)

  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 created with the if keyword in JavaScript. In the
    simple case, we want some code to be executed if, and only if, a certain condition
    holds.
    We may, for example, want to create
    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( ){ }
    Else{ }

1 Like
  1. A fragment of code that produces a value
  2. Bindings are variables that can be named and stored.
  3. An environment is a collection of variables and their values that exist at a given time in a program.
  4. A function is a piece of a program wrapped in a value.
  5. Console.log(“Good day to you!”); will print “good day to you!” in the log.
  6. A side effect is the output of the function, for example, a side effect could be a dialog box or writing text to a screen.
  7. If I enter an alert(“Hello world!”) within the console of google chrome then the side effect will be for the web page to say “Hello world!”. The function Math. min takes whatever number arguments it is given and gives back the smallest value. An example of Math. min would be console.log(Math. min(3, 4) + 150); which would result in the result 153.
  8. This is the direction of how the JavaScript emulator reads your code step by step, in this case, it is left to right and down, as we type.
  9. Conditional execution is simply thought of as “if X happens, then do Y, else do Z”
  10. The kind of keyword do you need to use to invoke conditional execution is “if”.
1 Like
  1. What is an expression?
    A fragment of code that produces a value

  2. What is a binding?
    You should imagine bindings as tentacles, rather than boxes. They do not
    contain values; they grasp them—two bindings can refer to the same value.

  3. What is an environment?
    e 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.

You can call a function by putting parentheses after an expression that produces a
function value. Usually you’ll directly use the name of the binding that holds
the function. The values between the parentheses are given to the program
inside the function.

  1. Give an example of a function.
    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”);

In the example, the prompt function uses the string that
we give it as the text to show in the dialog box. Values given to functions are
called arguments.

  1. What is a side effect?

Showing a dialog box or writing text to the screen is a side effect. or it could change the internal state of the machine in a way that will affect the statements that come after it.

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

prompt(“Enter passcode”); Side effect.

console.log(Math.max(2, 4));
// → 4
When a function produces a value, it is said to return that value. Anything
that produces a value is an expression in JavaScript, which means function
calls can be used within larger expressions.

  1. What is control flow?

The statements are executed as if they are a story, from top to bottom.

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.

  1. What is conditional execution?

a branching road, where the program takes the proper branch based on the
situation at hand.
Conditional execution is created with the if keyword in JavaScript. In the
simple case, we want some code to be executed if, and only if, a certain condition
holds.

  1. What kind of keyword do you need to use to invoke conditional execution?
    Conditional execution is created with the if keyword
1 Like
  1. A fragment of code that produces a value is an expression
  2. Binding is giving statements values by indicating what you want the value to be by typing the statement = Value. My Age = 35 or 5 * 7. Now that a statement is binded it can now be use as an expression.
    console.log(My Age - My Age)
    0
  3. A collection of bindings that exist at any given time that provide ways to interact with the surrounding system.
  4. A function is a piece of programing wrapped in a value. Values can be applied in a default environment to have a type of function.
    5.Funtions produce side effects. Showing a dialog box or writing text is also a side effect.
  5. console.log(Math.min (3,6)) =3 console.log(Math.max (3,6) +100) = 106
  6. When a program contains one or more statements that executes from top to bottom.
  7. Creating a branch on how the program executes based on a the situation you would want the program to execute.
  8. if or else
1 Like
  1. An expression is a fragment of code that prodcues a value.

  2. A binding catches and holds a value.

  3. An enviroment is the collection of bindings adn their values.

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

  5. An example of a function:

prompt("Enter Passcode")
  1. A side effect is an observale value such as a dialog box or writing text being diplayed to the user.

  2. An example of function with a side effect:

let theNumber = Number(prompt("Pick a number"));
console.log("Your number is the square root of" = theNumber * theNumber);

An example of function without a side effect:

console.log(Math.max(2,4));
  1. Control Flow is when your program contains more than one statement. The statements are executed from top to bottom.

  2. Conditional Execution is when a program takes one of two branches to reach a value based on the situation at hand.

  3. The keyword to invoke Conditonal Execution is the If keyword.

1 Like
  1. Fragment of code that produces a value.

  2. assigning a value, function or expression to a variable with the command:
    Let value = variable
    var value = variable
    const value =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

  1. console.log is a function that out puts values

Prompt ('message") is a function that produces a dialog box you can set conditions to depending on the results.

  1. A side effect is function that produces a dialog box or written text

  2. Prompt ('message") is a function that produces a dialog box you can set conditions to depending on the results. This is an example of a function that produces a side effect. as to where console log produces/ return a value. Boolean functions produce a statements such as true or false.

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

9.Conditional execution is created with the if keyword in JavaScript. In the
simple case, we want some code to be executed if, and only if, a certain condition
holds.

1 Like
  1. A peice of code which holds value.

  2. Binding helps to find and hold a value.

  3. Bindings and values combined is the environment.

  4. Program embedded in a value is a function.

  5. prompt console.log

  6. Code that shows a dialog box or text is aside effect.

  7. Value:

let num = Number(prompt(“Pick a number”));
if (num < 10) {
console.log(“Small”)
}
Side effect:

prompt(“Pick a number”);

  1. The order and direcrion of the execution of the code.

  2. Code which is executed only when required conditions are met.

  3. if and else

1 Like
  1. What is an expression? A fragment of code that produces a value.
  2. What is a binding? A binding is a variable. It’s a way for a program to remember things.
  3. What is an environment? The environment is the collection of bindings.
  4. What is a function? A function is a piece of a program wrapped in a value.
  5. Give an example of a function. console.log(“hello”); alert(“hi!”);
  6. What is a side effect? A side effect is showing an alert 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(“Enter your name:”); Value: function myFunction() { return true; }
  8. What is control flow? Control flow refers to how a program executes statements, from top to bottom.
  9. What is conditional execution? This executes statements only if the conditions are met. It allows for different branches of a program.
  10. What kind of keyword do you need to use to invoke conditional execution? IF
1 Like