Binding, Functions and Control Flow - Reading Assignment

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

A binding is a thing that catches and holds values.

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

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

console.log

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

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

prompt("Enter passcode");

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

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.

if

1 Like
  1. Expression is a fragment of code that produces a value
  2. Binding is used to “catch and hold” values. It’s defined by the “let”, “var”, “const” and “prompt” words
  3. Environment is a collection of bindings and their values that exist at a given time.
  4. Function is a piece of program wrapped in value
  5. prompt(“give an example of function”)
  6. Side effect is showing a dialog box or writing text to the screen
    7.console.log(2 * 2) produces value
    alert(“this is side effect”)
  7. Control flow is a few statements or functions making one program in the way that later ones depend to the previous one (like a story from the top to bottom)
  8. Conditional execution is branching program where the way that functions work depend to the certain conditions in that particular case.
  9. to invoke conditional execution words we need to use one of following words: if, if else,
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding ‘catches and holds’ values.
  3. An environment is a collection of bindings and their values that exists at a point in time.
  4. A function is a chunk of code (program) wrapped in a value. The value can then be used to execute the wrapped program.
  5. function myFunction(p1, p2) {
    return p1 * p2; // The function returns the product of p1 and p2
    }
  6. A side effect is the result of a return from a function, or in other words, a snippet of code that affects subsequent lines of code outside of its current environment.
  7. A function producing a dialogue box is a function with a side effect. The Math.min function is a function that will produce a value.
  8. When a program has more than one statement, they are executed from top to bottom.
  9. Conditional execution means that code is only executed if certain conditions exist.
  10. If
1 Like
  • What is an expression?
    An expression is anything that can evaluate down to a value. A fragment of code that produces a value.
  • What is a binding?
    A binding catches and holds values. They act like tentacles, rather than boxes, and grasp onto values. Programs can only access values with bindings that are still intact.
  • What is an environment?
    An environment is the 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, which can be applied in order to run the wrapped program and perform a specific task.
  • Give an example of a function.
    prompt(“Enter password”);
  • What is a side effect?
    The changes that are produced by altering the state of something. A side effect produces a change in the program’s state caused by an expression or a function call, or modification of a global variable in a procedure or function.
  • Give an example of a function that produces a side effect and another function that produces a value.
    Function that produces a side effect:
    prompt(“Enter your name”)
    Function that produces a value:
    1;
    !false;
  • What is control flow?
    Control flow in programming is the way the program is executed, JS is performed top to bottom.
  • What is conditional execution?
    Conditional execution is a function that allows the program to execute some code if the statement provided agrees with the condition.
  • 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 thing that catches and holds value.

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

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

  5. prompt(“What day is it today?”);

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

  7. An example of a function that produces a side effect is the function ‘prompt’ which is used to show a dialog box to the user. An example of a function that produces a value is the function ‘Math.max’ which returns the highest number out of all the numbers within its ().

  8. Control Flow is the order that the statements in a program are executed. Statements are executed top to bottom.

  9. Conditional execution can be done using the ‘if’ keyword. Sometimes we want the program to produce different outputs based on the situation, so we use conditional execution so that some statements in the program do not get executed unless certain conditions are met.

  10. The ‘if’ keyword is used to invoke a conditional execution.

1 Like

Thank You,… i believe this is where i need to be

1 Like
  1. A piece of code that produces a value.
  2. Binding is used to hold/stick/memorize the values using variables.
  3. It is a collection of bindings and their values that exists in memory at a given time.
  4. Function is a piece of program that can execute some tasks. Function is a wrapped in a value.

function myFunction(a, b) {
return a * b;
}
6. Showing a dialog box or writing text to the screen is a side effect.
7.
prompt(“Enter passcode”);
//another function
console.log(Math.max(21, 25));
8. It is executing of statements from top to bottom
9. It is when there is two or more situations of executing of statements and the program chooses one based on conditions.
10. if, else

1 Like

Questions:
. Expressions are pieces of code which create values.
. Binding is needed to catch and maintain values so that programs can store states of a computer.
. Environment is a selection of bindings and their values as of a particular time.
. Function is a program contained inside a value, which may be executed to perform a task.
. One example is: prompt(“Where are you from”).
. When a written statement or dialogue box is provided on the computer screen
. prompt(“What is your name”), produces a side effect, console.log(Math.max(1,2)), produces a value.
. When there are multiple statements in a program so that they are executed in a controlled order.
. When there is a branched program so that the program takes a branch depending on whether certain conditions are fulfilled.
. If, else if and else are needed for conditional execution.

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

  2. What is a binding? Bindings allow values to be recalled from pervious statements. The “let” keyword indicates that a given sentence will define a given binding.

  3. What is an environment? Environments are a collection of Bindings and their values that exist at a given time.

  4. What is a function? Functions are pieces of programs wrapped in a value.

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

  6. What is a side effect? Side Effects are functions that writes out its argument in some form of text or output device.

  7. Give an example of a function that produces a side effect and another function that produces a value. A function that produces a side effect output such as the prompt (“Enter Passcode”); function.
    Functions that produce values in which no side effect occurs would be console.log.

  8. What is control flow? A control flow is a program that contains more then one statement executed from top to bottom.

  9. What is conditional execution? Conditional executions are where the program takes the proper branch based on a given situation at hand. created by the keyword “if”.

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

1 Like
  1. Expression is a statement or equation
  2. making program catch or hold value
  3. Environment is an internal state of program in a given time
  4. Function is a set of arguments/operations that return a certain result
  5. console.log() Number()
  6. Side effect is when the program change the internal state of the machine
  7. side effect - alert(), value - Number()
  8. sequence of programing execution
  9. branching
  10. If
1 Like
  1. What is an expression?

A fragment of code that produces a value is called an expression

  1. What is a binding?

To catch and hold values, JavaScript provides a thing called a binding. The special word let indicates that this sentence is going to define a binding. It is followed by the name of the binding and, if we want to immediately give it a value, by an = operator and an expression. 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?

A function is a piece of program wrapped in a value. Such values can be applied in order to run the wrapped program.

  1. Give an example of a function.

prompt holds a function that shows a little dialog box asking for user input.

  1. What is a side effect?

A side effect is the modification of state through the invocation of a function or expression. For a function or expression to have a side effect, the state it modifies should be out of its local scope.

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

Prompt or console.log are examples of functions which result in side effect but Math.Max or Math.min produce value.

  1. What is control flow?

Statements are executed from top to bottom sequentially, straight-line control flow

  1. What is conditional execution?

A program with branches (not a straight road). The program takes the proper branch based on the situation.

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

If , else keywords

1 Like
  1. What is an expression?

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

  1. What is a binding?

Bindings also known as variables catch and hold values.

  1. What is an environment?

An environment is the collection of bindings and their values that exist at a given time. Such as the bindings of the language standard and functions for interaction with the system.

  1. What is a function?

A function is a piece of program wrapped in a value. These values can be applied to run the wrapped program.

  1. Give an example of a function.

Prompt(“Enter Username”)

  1. What is a side effect?

A side effect can be writing text to the screen or a dialog box. With functions it is the effect of returning something other than the return value.

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

Function that produces side effect:

console.log(Math.max(2, 6));

alert (‘hello world’);

Function that produces a value:

console.log(Math.max(2, 6));

  1. What is control flow?

Control flow is the order in which statements are executed, in programs they are executed top to bottom.

  1. What is conditional execution?

A conditional execution is similar to a fork in the road. The program will execute (pick a path) based on the situation or if the conditions hold.

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

If.

1 Like

An expression is a fragment of code that produces a value. Multiple expression can have multiple functions which means once combined, it allows for complex computations within a program to occur.

Binding, in a way, is an internal memory system for the computer which logs the value/purpose of pieces of code. Binding allows a program to have an ‘internal state’ which the foundational basis upon which the program’s code is written. Once a binding has been defined, it can be used as an expression later on.

‘Environment’ is a term given to a collection of bindings and their values that exist at a given time. For example, when you load up a website there are functions that are existing in order to make the website accessible, interactive, animated etc. - these bindings and their values will be called the ‘environment’.

A function, in its rudimentary form, is wrapped code that can be called, invoked or applied to perform a certain action.

The function: ‘prompt’ can be called forth in a web browser to display a notification box.

A side effect is basically a change in a programs state caused by an expression or a function call.

A function that produces side effect:

console.log(firstAccount);

A function that produces value:

var firstAccount = accounts[0];

Control flow is the term used to describe the way in which the computer reads code - which is in a top to bottom ordered fashion. As story a story is structure with a beginning, middle and end - so is code.

Even though the control flow reads and executes code in an ordered fashion, a conditional execution will only be executed if a certain condition holds.

‘If’ or ‘else’

1 Like
  1. A fragment of code that has a value, is an expression.
  2. A binding is to catch and hold a value.
  3. A collection of bindings and their values that exist at a given time is an environment.
  4. A function is a piece of program wrapped in value.
  5. Prompt.
  6. Showing a dialog box or text to screen is a side effect.
  7. Math.max will give a value. Math.min does just the opposite.
  8. When a program contains more than one statement, it reads them like a story.
  9. When a program takes a certain path based on the situation, is conditional execution.
  10. “if” is the keyword for conditional execution.
1 Like
  1. What is an expression?
    A fragment of code that produces value.

  2. What is a binding?
    Binding or variables are containers o store values.

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

  4. What is a function?
    It’s a piece of code design to perform a specific task.

  5. Give an example of a function.
    prompt(“Enter something nice”);

  6. What is a side effect?
    It’s any reaction other than the return value.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    ex1:
    prompt(“Enter something nice”);
    ex2:
    console.log(Math.min(2, 4) + 100);
    102

  8. What is control flow?
    The order in which statements are executed. From top to bottom.

  9. What is conditional execution?
    When we execute a piece of code depending on some condition. We want to something happen if, a certain condition holds.

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

1 Like
  1. What is an expression? Is a fragment of code made up by values and or operators to make additional values. Also expression can be placed inside of other expressions.
  2. What is binding? Binding is a another name for variable. Variable predefined names are let, var, const., When a binding points at a value, that does not mean it is tied to that value forever. The = operator can be used at any time on existing bindings to disconnect them from their current value and have them point to a new one. The equal sign can be a edit tool to alter what the binding is connected to. Bindings are more like having tentacles to reference values, 2 bindings can reference the same value. When a tentacle of a binding has nothing to grasp hold of, you will get “undefined”. A single “let” statement may define multiple bindings seperated by commas. The word const defines a constant binding that points to the same value for as long as it lives, can be useful to give a name to a value that it can be easily referred to later.
  3. What is an environment? Is a collection of bindings and values that exist at the time. A program often has bindings to provide ways to interact with the environment.
  4. What is a function? A function is a piece of program wrapped in a value. These type of values can be applied to run the wrapped program. Use parentheses when executing a function, this is called calling, invoking, or appling. The values between the parentheses are given to the program
    inside the function. Values given to functions are called arguments.
  5. Give an example of a function. “prompt” and “console” is a function
  6. What is a side effect? Showing a box or text on the screen is an example of a side effect. Functions return side effects. Changing the internal state of the machine to effect statements that come after it is a side effect.
  7. Give an example of a function that produces a side effect and another function that produces a value. console.log- produces a value by the function given to it
    The “alert” function is a side effect by the function given to it
    8.What is control flow? Is statements that are executed from top to bottom.
  8. What is conditional execution? Is the process of creating a branching road in the program by using keywords (if, else)
    10 What kind of keyword do you need to use to invoke execution? if, else, else if, true/false
1 Like
  1. An expression is a fragment of code that produces a value

  2. a binding is used to hold a new value. Without a binding the new values would dissapate if not used immediatly so a binding allows the computer to “remember” things

3.an enviroment is a collection of bindings and their values

  1. A function is a piece of program wrapped in a valuie. These values can be applied in order to run the program.

  2. For example the binding “prompt” holds a function that would show a dialog box asking for user input. So prompt (“enter passcode”); would give you a dialog box that the user can enter a value in to, with the text above it saying enter passcode.

  3. A side effect shows a dialog box or writing text to the screen

  4. alert(“text”); would show a side effect
    consol.log (1+1); would show a value

  5. a control flow is the order in which statements are executed if the program contains more than one statement.

  6. conditional execution is wherethe program can branch to a different path in the control flow based on the situation or certian conditions being met

  7. you need the IF keyword to creat a conditional execution

1 Like
  1. What is an expression?
    A fragment of code that produces a value is called an expression
  2. What is a binding?
    A binding or a variable keeps values with given names for a later usage
  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
    5.Give an example of a function.
    prompt, alert, console.log
    6.What is a side effect?
    A change in the internal state of the machine in a way that will affect the statements
  5. Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“Enter name”);
    console.log(Math.min(2, 4));
  6. What is control flow?
    Control flow is the order in which we code and have our statements
  7. What is conditional execution?
    the task is executed just if the conditions are met
    10.What kind of keyword do you need to use to invoke conditional execution?
    “If”
1 Like
  1. What is an expression?
    A fragment of code that produces a value

  2. What is a binding?
    A way of capturing the output of an expression

  3. What is an environment?
    The state of the bindings and their values at a given time

  4. What is a function?
    A small program which executes an action, within the broader coding language

  5. Give an example of a function.
    Prompt function

  6. What is a side effect?
    The effect of statement on other values in the environment

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Prompt
    Math.max

  8. What is control flow?
    Execution of code in the sequence it is written

  9. What is conditional execution?
    When the flow of the code is branched based on a condition

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

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

  2. A binding is a variable that can be linked to a value such as ‘let age = 10’ - age is the binding which is linked to the vale 10. Other variable can also be linked to the same value. Also the value of ‘age’ can be changed by linking it to a new value. You can also have constant values which have the same value as long as the binding exists ‘const’. There are certain keywords that cannot be used as bindings as well as words that are reserved for future use that cannot be used as bindings.

  3. An environment is a collection of bindings and their values that exist at a given time. An environment also contains bindings that are part of the program language standard and ways to interact with the system such as ways to read inputs from keyboard or mouse.

  4. A function is a piece of program wrapped in a value. The value is then applied to run the piece of the program.

  5. prompt; is a function console.log is another.

  6. A function can produce a side effect such as displaying a dialog box or text on the screen.

  7. ‘alert’ produces a side effect, Math.min produces a value.

  8. Control flow is the order in which statements are executed.

  9. Conditional execution allows you to split the control flow b depending on the situation.

10 the ‘if’ keyword provides a conditional execution.

1 Like