Binding, Functions and Control Flow - Reading Assignment

  1. an expression is anything that produces a value.
  2. bindings are used to catch and hold values.
  3. an envirionment of bindings and their values that exist at the same time.
  4. a function is a piece of program wrapped in a value.
  5. an example of a function is prompt(“hello”);
  6. side effect is when something affects or modifies the state of something else.
  7. a side effect example is : prompt(“what is your age?”);
    a function that produces a value : console.log( 2 + 4);
    8.control flow is the order in which statements are executed in a program.
  8. conditional execution is when there is a branching road and the program picks a proper branch based on the situation.
    10.the keyword you use to invoke a conditional execution is “if”.
1 Like
  1. What is an expression?

An expression is a fragment of code that may consist of one or more operators, operands that evaluated to yield a value.

  1. What is a binding?

A binding is a reference or association of an identifier or variable to hold values .

  1. What is an environment?

An environment is the space that provide ways to facilitate interaction within the surrounding systems. In programming, the environment provides a set of process, values, variables and the programming tools to develop program or software product.

  1. What is a function?

A function is a block of organized codes that can be reused to perform a specific related task. It creates the output result from its input without having to know how it works internally. A function can be called from inside of another function.

  1. Give an example of a function.

Example is the math function sqrt () or the console.log function in the web browser that display the output in the console.

  1. What is a side effect?

Side effect means a function called can change the state of a variable or program outside of its scope.

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

Side Effect of a function that cause the global age being modified.
var age = 8;
function getAge(age) {
age = 6*age;
return age;
}

Pure function returns a new age without affecting the global variable age.
var age = 8;
function getAge(age) {
let futureAge = 6 * age;
return futureAge;
}

  1. What is control flow?

Control flow is to control and direct the order of the program flow instead of executing code statements sequentially by default.

  1. What is conditional execution?

Conditional execution is the part of the code is to be executed next based on the state of a evaluation or result of an action that satisfied the specified condition otherwise the program execution will branch to alternate flow path based on the evaluation of condition status.

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

The if, if…else if…, switch, for and while keywords can be use to invoke conditional execution.

1 Like
  1. What is an expression?
    Expression is any piece of code that returns a value, expressions can be layered with other expressions making larger expressions.
  2. What is a binding?
    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?
    Environment is the collection of bindings that exist at a given time.
  4. What is a function?
    Function is a piece of programming wrapped in a value. It is a line of code in the block that we can call as many times we need
  5. Give an example of a function.
    alert (“This is my script”), prompt…
  6. What is a side effect?
    Showing an alert or dialog box
  7. Give an example of a function that produces a side effect and another function that produces a value.
    Function that produces side effect is console.log
    Function that produces value is math.max
  8. What is control flow?
    Control flow is order in which statements are executed within a program.
  9. What is conditional execution?
    It apears and executes only if a condition is met.
  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. A binding is a variable that can be assigned to values.
  3. Environment is a collection of bindings and their values
  4. Function is an expression wrapped in a value.
  5. alert(“I love Ivan on Tech Academy”);
  6. Side effect is a function which produces an expression and returns that value
  7. Ex: console.log(number1 = 70);
    var number1 = 35*2
  8. Control flow is the order that a program executes code
  9. A point in time when a program has to decide what to do
  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?
    To catch and hold values, JavaScript provides a thing called a binding

  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. Such values can be applied in order to run the wrapped program. For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input.

  5. Give an example of a function.
    Se above.

  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.
    The helper function in the farm example, printZeroPaddedWithLabel, is called for its side effect: it prints a line.
    console.log(Math.max(2, 4));
    // → 4

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

  10. What kind of keyword do you need to use to invoke conditional execution?
    Conditional execution is created with the if keyword in JavaScript.

1 Like

1.- A fragment of code that produces a value.
2.- A way for a program to keep its internal state, binding is the same as a variable.
3.- Bindings that are part of the language standard.
4.- Piece of program wrapped in a value.
5.- alert()
6.- When a function modifies stuff out of its scope or supposed range of action.
7.- console.log(Math.max(2, 4));
// → 4
8.- The way the program reads the code.
9.- A situation that will only happen if a certain condition is met.
10.- if, else

1 Like
  1. What is an expression?
    A piece of code that returns a value

  2. What is a binding?
    Using a keyword to tie to a variable

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

  4. What is a function?
    A segment of code contained in a value

  5. Give an example of a function.
    Number.isNaN

  6. What is a side effect?
    A side effect changes the internal state of the machine in a way that will affect the statements that come after it. For example, creating a dialog box.

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

  8. What is control flow?
    If your program contains more than one statement, they are executed from top to bottom

  9. What is conditional execution?
    Conditional execution allows for an element to be constructed in a way that will only provide an outcome if certain conditions are met.

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

1 Like

1. What is an expression?
It is a fragment of code that produces a value.
2. What is a binding?
It catches and holds values. It can be dynamic depending on redefining the binding throughout the program.
3. What is an environment?
It is a collection of bindings and their values that exist at a given time.
4. What is a function?
It is a piece of a program wrapped in a value.
5. Give an example of a function.
console.log(“Give an example of a function.”);
6. What is a side effect?
It is the resulting output from execution such as a evaluating a function.
7. Give an example of a function that produces a side effect and another function that produces a value.
Side effect would be prompt(“side effect produced”);
Function value would be console.log(2+2);
8. What is control flow?
The order of processing statements in the program.
9. What is conditional execution?
Execution that uses logic to execute certain pathways of the program. This is typically executed using the if-else statements.
10. What kind of keyword do you need to use to invoke conditional execution?
You would use the keyword “if.”

1 Like
  1. A fragment of code that produce a value
  2. Javascript code used to cach and hold values
  3. The collection of blindings and their value exist at a given time
  4. A pice of program wrapped in a value
  5. Prompt function, console.log function
  6. Showing a dialog box or writing text to the screen
  7. console.log(firstAccount);
    var firstAccount = accounts
  8. The program contain more than one statment and the statment are excuted as if they are a story, from top to bottom.
  9. It is created with the if keyword in javascript , the lroper branch based on the situation at hand
  10. It depend on the value of bulean expression.
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding is a variable where we can store values/data.
  3. An environment is a 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("Enter passcode: ");
  6. A side effect appears when a function modifies the state of something else, for example a dialogue box.
  7. prompt("Enter your age: ");
    console.log(Math.max(2,4));
  8. Control flow is the order in which the program will execute code.
  9. Conditional execution appears when the program has different routes for different values.
  10. if keyword
1 Like
  1. An Expression returns a value
  2. A binding is a storage for holding value
  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. prompt("Enter password);
  6. Showing a dialog box or writing text to the screen is a side effect. A lot of
    functions are useful because of the side effects they produce.
  7. Function with side effect: alert(“Hello World”);
    Function that produces value: console.log(Math.min(2, 4) + 100);
    // → 102
  8. Control flow is order how program reads and executes code
  9. Conditional Execution is when the program takes a proper branch for the situation at hand. Program needs to decide what to do next, it depends of conditions
  10. if or else
1 Like
  1. An expression is a fundamental part of the structure of a program, and basically it’s a fragment of code that produces a value.

  2. Binding is the process of obtain a value and hold it for using it in anytime in the future. It is a useful part of a program because once the value is kept through a binding name, it could be used as part of an expression.

  3. The environment is defined as the group of binding and expressions used to run a program in order to interact with the system.

  4. A function is the action wrapped inside a value.

  5. An example of a function is the operation of console.log (). It retrieves a messages and post it in the page, or it allows an specific operation to be performed inside the parenthesis .

  6. A side effect is any returned value obtained after using a function.

  7. Function that produces a side effect→ alert (“Hello”)
    Function that produces a value→ console.log (“hello”)

  8. Control flow is the order the codes are following in a program from top to bottom.

  9. Conditional executions are functions able to alter the regular flow of an script in a program, in such manner the flow might takes different ways.

  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?
    It allows the programs to catch and hold values.

  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.

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

  6. What is a side effect?
    A side effect means that the functions produce something like a dialog box.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt (“What your name”); Side effect user has to write an answer
    console.log(Math.max(2, 4)); Only produce a value

  8. What is control flow?
    The statements are executed from top to bottom. It is like a story.

  9. What is conditional execution?
    A conditional execution is applied for a specific input.

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

1 Like
  1. What is an expression? Expresion is a value resolved from values.
  2. What is a binding? Binding catch and hold value.
  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 value.
  5. Give an example of a function. prompt(“how much?”);
  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(“how much?”); Math.max(2, 4);
  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.(left to right)
  9. What is conditional execution? Branching road in a program where program takes proper branch based on the situation.
  10. What kind of keyword do you need to use to invoke conditional execution? if , can be combined with else
1 Like
  1. A fragment of code that produces a value is called an expression.

  2. A “binding” is a variable. E.g.:
    let a = 1;
    const b = 2;
    You should imagine bindings as tentacles, rather than boxes.

  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. An example of a function:
    function sum(a, b)
    {
    return a + b;
    }

  6. A side effect is a change of 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.

  7. prompt("Enter your name: ");
    console.log(Math.max(2,4));

  8. “Control flow” refers to the order in which code is processed.

  9. “Conditional execution” is the execution of a piece of code that requires a condition to be fulfilled.

  10. if, else if, else

1 Like

1. What is an expression?
An expression is a fragment of code that produces a result.

2. What is a binding?
A binding is how Javascript holds values.

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

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

5. Give an example of a function.
An example would be the console.log() function in Javascript.

6. What is a side effect?
A side effect is when a function executes and produces some specific result such as a outputting text to the screen or a displaying a dialog box.

7. Give an example of a function that produces a side effect and another function that produces a value.
An example of a function that produces a side effect would be the alert prompt and the Math.min() function that produces the smallest value in a pair of numbers.

8. What is control flow?
Control flow is the order in which we code and have program statements executed.

9. What is a conditional execution?.
Conditional execution is a path in your program that is executed if a specific condition has been achieved.

10. What kind of keyword do you need to use to invoke conditional execution?
The “if” and the “else” Javascript keywords are used to invoke conditional execution.

1 Like
  1. It is a fragment of code that produces a value.
  2. It holds values like 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. console.log()
  6. Showing a dialog box or writing text to the screen is aside effect.
  7. Function that produces side effect: prompt(), function that produces value: Math.min().
  8. When program contains more than one statement, the statements are executed as if they are a story, from top to bottom - in control way.
  9. In the simple case, we want some code to be executed if, and only if, a certain condition holds.
  10. if, else, else if
  1. What is an expression?
    An expression is just a a piece of code that gives an outcome.

  2. What is a binding?
    A binding is an item that has been bound to a particular value or expression. It is more commonly known as a variable.

  3. What is an environment?
    It is the entire collection of bindings and their values at the current point in time.

  4. What is a function?
    A function is a piece of code that is wrapped in a value. It gives the program a set of instructions to apply the function.

  5. Give an example of a function.
    console.log();

  6. What is a side effect?
    A side effect is any change that occurs other than the return of the function output. Functions that produce other effects than simply giving an output are classed as having a side effect.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt is an example of a function that produces a side effect. Console.log is a function that produces a value.

  8. What is control flow?
    Control flow is just the order in which the script is read. The code is read from left to right, top to bottom, like you would read a book.

  9. What is conditional execution?
    Conditional execution is where a program can have multiple paths and takes the one it is told to based on the circumstances. The program is set up with multiple pathways that it could take, based on the information it receives.

  10. What kind of keyword do you need to use to invoke conditional execution?
    The keyword usually is the ‘if’ statement.

  1. What is an expression?
    An expression is a fragment of code that produces a value.
  2. What is a binding?
    A binding occurs when you a keyword like, let, var, or const, to define a binding and attaching it to a value.
  3. What is an environment?
    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.
    An example of a function would be the console.log.
  6. What is a side effect?
    A side effect is when a function shows 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.
    let theNumber = Number(prompt(“Pick a number”));
    console.log("Your number is the square root of " + theNumber * theNumber);
  8. What is control flow?
    The control flow is the program’s order that statements are executed if there are multiple statements. They are always executed from top to bottom.
  9. What is conditional execution?
    Conditional execution is adjustments to the control flow. By adding branching roads to the control flow the program can adapt to a situation when conditions are met.
  10. What kind of keyword do you need to use to invoke conditional execution?
    In order to invoke a conditional execution in JavaScript, we use the keyword “if” and/or “else”.

1.What is an expression?
An expression is a piece of code that gives a value. It is part of a larger statement.
2.What is a binding?
A binding is the connector to the the values, and is movable and changeable to other values, so they are impermanent.
3.What is an environment?
An environment is a collection of the bindings and values.
4.What is a function?
A function is the program wrapped up in the value.
5.Give an example of a function.
The prompt binding (box) is the function of the user input.
6.What is a side effect?
A side effect is a change that affects the statement, an effect other than the return value.
7.Give an example of a function that produces a side effect and another function that produces a value.
function + WithSideEffects(x, y) { alert(“This is a side effect”); return x + y; }
console.log(3*6)
8. What is control flow
A control flow executes statements from top to bottom.
9. What is conditional execution?
Conditional execution means execution is not flowing straight but is created using keywords like if, while, do etc.
10. What kind of keyword do you need to use to invoke conditional execution?
If is used.

1 Like