Binding, Functions and Control Flow - Reading Assignment

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

  2. A way in which JavaScript catches and holds value.

  3. 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(“Enter passcode”);

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

  7. a.) alert(“side effect”);
    b.) console.log(Math.min(2, 4) +100);

  8. When a program contains more than one statement, the statements are executed in order from top to bottom.

  9. When we want some code to be executed if, and only if, a certain condition holds.

  10. If and/or else

1 Like
  1. An expression is anything that returns a value in JavaScript (JS) programming.To be useful values need to be framed in larger structures and worthwhile to have "side effects."Expressions can include numbers, symbols, and operators and statements are closed by semicolons. Expressions may be fragments of code, unary or binary operator applications; a sentence between parenthesis, and a program is a list of statements.
  2. Binding is related to values in what is unique to JS is “catch and hold” function so that changing values from old to new are used and useful. Otherwise the information or data is lost. It is difficult to define, but once defined, it’s name can be used as an expression. Several words used to create bindings are “let,” “Var,” and “const.” Bindings need values to “catch, hold, and grasp”. Otherwise, the binding is empty and value “undefined.”
  3. An environment consists of a collection of bindings and their values at a given time including ways to interact with surrounding systems.
  4. Functions are named groups of statements that can be re-used by declaration, calling (also said to be “invoking” a repeatable block of code and executing actions or performing tasks using keywords.
  5. Examples: Console.log, the

    ELEMENT used to create paragraphs. Var X =. Perhaps “return expression.”

  6. Side effects are the changes that occur as the results of statement in JS programming. The concepts of “return of value” is the important idea of side effects. Programs with side effects are the opposite of useless programming that have no value to the world.
  7. The productions of values due to functions that return a value that is a side effect sometimes meets the criteria of both value and side effect. Listed in the text was the showing of a dialog box or writing text to screen is a side effect.
    A value can be less meaningful but still a value. Example from text was
    Value 1;
    !false;
    Value is 1
    A value showing debt reduction over time is a more meaningful example of value.
  8. Control flow is the ordering and managing of statements in JS programming. When there are more than one statement, the sequencing of a programmable story, pathway in JS form makes sense of the statements.
    9.Conditional execution is related to control flow of statements that depend on the situation available. The program story is more complicated and offers several options or alternative pathways as guidance to the proper answer. The structures use semicolons and braces are used between statement. Errors in their use can cause confusion, and undefined answers.
  9. Keywords are used to invoke conditional executions such a s"if," “and,” and “else ifs.”
1 Like
  • What is an expression? A fragment of code that produces a value is an expression.

  • What is a binding? Binding are used to catch and hold values. After a binding is defined, it’s name can be used as an expression. Bindings can be changed. 2 bindings can refer to the same value. “let”, “var” and “const” can be used to define bindings.

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

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

  • Give an example of a function. prompt function

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

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

  • What is control flow? Statements are executed from top to bottom in a program.

  • What is conditional execution? Conditional execution is created with the if keyword. Code will only be executed if a certain condition holds.

  • 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 way to save a value to memory and recall that value by name later.
  3. An environment is a collection of bindings and their values that you have saved at any given moment.
  4. A function is a piece of program that is wrapped in a value and can be executed by invoking or calling it by name.
  5. An example of a function would be prompt() as used in the book or even alert() we used in the last few videos.
  6. A side effect is anything a function does that is not related to the direct mapping of inputs to outputs.
  7. An example of a function with a side effect would be the prompt() function and the side effect of showing a dialog box on the screen.
  8. Control flow refers to the order the computer executes commands; like a story, from left to right, top to bottom.
  9. Conditional execution is when an action is only carried out if another condition is met first.
  10. The keyword needed for conditional execution is “if/else”.
1 Like
  1. What is an expression?
    A piece of code that produces a value is an expression, a value written literally, or values between binary and unary operators are expressions.

  2. What is a binding?
    A binding is a term used to catch and hold values. For example, keywords may indicate that their sentence may define a binding.

  3. What is an environment?
    An environment refers to the collections of bindings and their values at any given time.

  4. What is a function?
    A functions is a piece of program that is wrapped in a value. A binding can hold a function, when the binding is called the function is applied.

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

  6. What is a side effect?
    Writing text to the screen or a dialogue box are side effects to a function.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“Enter Username”);
    console.log(math.max(4,8));

  8. What is control flow?
    Control flow is when the statements in the program are executed one after the other from top to bottom.

  9. What is conditional execution?
    This is when there is a branch in the program where something may only be executed if its conditions are met.

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

1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding is something that holds values to be used at a later time.
  3. The 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 in a browser environment.
  6. A side effect is a statement/function that modifies the state of something else.
  7. Side effect example is the prompt function. Value example is the Math.min or Math.max functions.
  8. Control flow is the order that the program reads the statements within the program, from top to bottom.
  9. Conditional execution is when a program branch off onto a certain path based on the situation at hand.
  10. The if keyword.
1 Like
  1. What is an expression? Code to produce a value
  2. What is a binding? Holds a value to a variable
  3. What is an environment? When multiple bindings have certain values at a particular time.
  4. What is a function? Produces value based on variables.
  5. Give an example of a function.
  6. What is a side effect? new dialog box or text produced by a finction
  7. Give an example of a function that produces a side effect and another function that produces a value. console.log(Math.max(2, 4));// → 4
  8. What is control flow? the top to bottom order of executions
  9. What is conditional execution? An “if,than” type of code that branches the flow
  10. What kind of keyword do you need to use to invoke conditional execution? “if”
1 Like
  1. What is an expression?
    code that end up giving some value is called expression.

  2. What is a binding?
    Binding is a way to access values. so you bind some names (i.e Variables) with the location of value. So anytime you want to access the value you use that name binding with it.

  3. What is an environment?
    Environment is collection of binding and values in a given time.

  4. What is a function?
    Function is piece of code that process the inputs and return output (value). That piece of code can be executed again and again by calling with its name.

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

  6. What is a side effect?
    A side effect is the modification of state through the invocation of a function or expression. In order for a function or expression to have a side effect, the state it modifies should be out of its local scope.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    function plus(x, y) { return x + y; }.

A “side effect” is any effect other than that return value. So, for instance:
function plusWithSideEffects(x, y) {
alert(‘This is a side effect’);
return x + y;
}

  1. What is control flow?
    Control flow is the sequence in which compiler execute the code line. Control flow move from top to bottom but you can change the flow using conditional statements or loops.

  2. What is conditional execution?
    Execution of code depending on the condition. if condition is true the code will execute otherwise it move on to the next code.

  3. What kind of keyword do you need to use to invoke conditional execution?
    If statements.
    conditional statements in for or while loops etc.

1 Like
  1. What is an expression?
    Return a value, depending on state of computation,
    a fragment of code that produces a value,
    an expression is a particular concept in which a number of variables or constants, and operators and functions, are put together in a single statement that is acted on by a particular programming language.

  2. What is a binding?
    binding is assigning one thing to another, usually, values to variables.
    A binding fixes a value or other property of an object (from a set of possible values).

  3. What is an environment?
    collections 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. A function is a block of code that performs a specific task.

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

  6. What is a side effect?
    Changing the value of a variable

  7. Give an example of a function
    that produces a side effect and another function that produces a value.
    console.log(Math.max(2, 4));
    // → 4

  8. What is control flow?
    The control flow is the order in which the computer executes statements in a script.
    Control flow means that when you read a script, you must not only read from start to finish but also look at program structure and how it affects order of execution.

  9. What is conditional execution?
    Conditional statements are used to decide the flow of execution based on different conditions. If a condition is true, you can perform one action and if the condition is false, you can perform another action.

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

If else statement

2 Likes
  1. What is an expression?
    A Fragment of code that produces a value.

  2. What is a binding?
    It is a command, that makes a variable last for the duration of the program (unless we change it)

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

  5. Give an example of a function.
    let double = number(prompt(“pick a number”))
    console.log(“double of a given number is” number*2)

  6. What is a side effect?
    Changing the value of the variable.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    let A = 5;
    let doubleA = (A=2*A);
    console.log(doubleA);

console.log(A);

  1. What is control flow?
    That is order in which computer executes the written code.

  2. What is conditional execution?
    Executing certain parts of code only under certain conditions.

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

2 Likes
  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 a value, JavaScript uses ‘bindings’ (or variables). After a binding has been defined, its name can be used as an expression. The keyword ‘let’ is used to define bindings, but also the keywords ‘var’ and ‘const’ can also be used along with any word; let txt1 = “Orange”, var num = 101, const x = 3.14

  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 piece of program wrapped in a value. These values can be ‘applied’ in order to run the wrapped program. Values given to a function are called ‘arguments’.

  5. Example of a function:
    Function CountInt(a,b){
    return a+b;
    }
    CountInt(5,8)
    //–> 13

  6. What is a side effect? When a function produces a value, it is said to ‘return’ that value. 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. WITH SIDE EFFECT:

JavaScript Functions

Example code of a function with side effects:

< p >The number is:< i id="test" >< /i>< /p>
< script >
function addNum(a,b) {
return a+b;
}
document.getElementById("test").innerHTML=addNum(12,7);
< /script >

The number is: 19

WITH VALUE:
(using example from book):
console.log(Math.min(2,4)+100;
//–> 102

  1. What is control flow? Programs that branch (instead of just executing one statement at a time from top to bottom) are said to have ‘control flow’.

  2. What is conditional execution? Based on the situation at hand, a program can evaluate a condition and execute one or the other pieces of the program in response to given scenario.

  3. What kind of keyword do you need to use to invoke conditional execution? The ‘IF’ keyword is typically used to control the flow of a program.

1 Like
  1. What is an expression?
    A fragment of code that produces a value is called an expression.
    Every value that is written literally (such as 22 or “psychoanalysis”) is an expression.

  2. What is a binding?
    To catch and hold values, JavaScript provides a binding, or variable.
    „let“, „var“, „cons“ are defining that there will be bindings

  3. 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(“Enter passcode”);

  1. What is a side effect?

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

  1. Give an example of a function that produces a side effect and another function that produces a value.
    Producing a side effect:
    Alert(„hello world“);
    Producing a value:
    console.log(Math.max(2, 4));

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

  1. What is conditional exeution?
    Is the case when we want some code to be executed if, and only if, a certain condition holds.

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

1 Like
What is an expression?

A fragment of code that produces a value.

What is a binding?

A way to catch and hold values

What is an environment?

Sum of bindings and values that exists at a single time

What is a function?

a part of a program that perform a certain task

Give an example of a function.

prompt(“Enter passcode”);

What is a side effect?

When a function modifies states outside its paramiters

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

side effect will be an alert
value will be math.max

What is control flow?

When code is executed top to bottom

What is conditional execution?

When a program has choices between paths to take based on the input or condition

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

if

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

  2. A binding gives (or binds) a name or keyword to a value.

  3. An environment is a collection of bindings and their values that exist at a given time. This collection acts as a map key for the program and sets the environment in which it runs.

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

  5. prompt(“Enter passcode”); is an example of a basic JS function.

  6. Showing a dialogue box or writing text to the screen are side effects.

  7. console.log(Math.max(2, 4)); will write to the screen as a side effect,
    console.log(Math.min(2, 4) + 100); will return a value and write that value to the screen.

  8. Control flow is the order that the computer reads the program, from top to bottom and left to right.

  9. Conditional execution is when a program takes the proper path based on the situation at hand.

  10. if and else are used to invoke conditional execution.

1 Like
  1. What is an expression?
    An expression is defined as a fragment of code that produces a value.
  2. What is a binding?
    Basically a thing to catch and hold a value.
  3. What is an environment?
    The collections of bindings and values.
  4. What is a function?
    A function is a piece of program which is wrapped in a value.
  5. Give an example of a function.
    For example the prompt(“Enter Passcode”) function.
  6. What is a side effect?
    A side effect is defined as 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.
    console.log(Math.max(2, 4))
    console.log(Math.min(2, 4) + 100)
  8. What is control flow?
    Describes the way the computer reads the program.
  9. What is conditional execution?
    A command consisting of two different paths to choose from depending on the if and else arguments.
  10. What kind of keyword do you need to use to invoke conditional execution?
    if and else.
1 Like
  1. An expression is a snipet of code that evaluates to a value.
  2. A binding catches or holds a value.
  3. The environment is the bindings and their values that exist at a given time.
  4. A function is a piece of program wrapped in a value.
  5. An example of a function is prompt.
  6. Side effects are changes to the internal state of the machine that affect the statements that come after it.
  7. Function that produces a side effect - console.log
    Function that produces a value - math.min
  8. Control Flow is the order that the instructions or statements or functions are executed.
  9. A conditional execution is when the code is to be executed if and only if a certain condition holds.
  10. if
1 Like
  • What is an expression?
    Any logical out put like 22 or dog

  • What is a binding?

It a reference to value that can be stored

  • What is an environment?
    It is all the bindings defeind for a certain program

  • What is a function?

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

  • Give an example of a function.

console.log

  • What is a side effect?

the effect of a statement on the system, a word on screen or acahgne in an internal value.

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

console.log produces text on screen

number.nan(number) produces a bolean value depending on the value number.

  • What is control flow?

your program executes like a story, one after the other.

  • What is conditional execution?

When a statement can have more than on result. if this is true then this happens else something else happens

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

if, while, else. they are bolean

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

  2. (variable) meant to catch and hold values within JS

  3. collection of bindings and their values that exist at a given time

  4. a piece of program wrapped in a value

  5. provide parentheses after an expression that produces a
    function value i.e.= function name( parameter 1, 2 .3 )

  6. any state change that is visible outside the function , Showing a dialog box or writing text to the screen

  7. side effect ex: alert(“this is an alert side effect”);
    value ex: ( 15>4) &&(9>7)

  8. order in which statements are executed ( usually top to bottom)

  9. branched road create by programmer / programmer modified statement execution order

  10. if, else

1 Like
  1. An expression is a fragment of a a code. It is as little as a plain number or string.
    Like number 35 or “Hello World”.

  2. Binding works like a tentacle instead of store of value, it will grasp on to whatever value it was referred to. For example: let MoneyOwned = 100
    Binding is the word: MoneyOwned that stores the value 100.

  3. Environment is a collection of bindings that exist at a given time. When you start a program you will have preset bindings that JavaScript has as standard.

  4. Function is expressions put together as a statement that produces a value.

  5. Function example:
    Function myFunction() {
    Alert(‘’This is my function’’);
    }

So every time i now write: myFunction();
Ill get output: This is my function

  1. Side effect is like an extension of a function that will produce a different value than expected.
    a pure function does not have any side effect and will always have same input as output. A side effect can be a pop up box or a text on the screen

  2. Side effect: alert(“Hello World”);
    Will open a pop up box with the string value.

Number: console.log(math.max(2,6,8);
8
This will give the greater value of the assigned ones

  1. The control flow is the order in the program that flows from top to the bottom when executing it. The statements are read one by one.

  2. Conditional execution is when the program is given an other option to execute. ‘’If not this, do that’’.

  3. Keyword to invoke conditional execution is the if and else expression.

1 Like

[quote=“ivan, post:1, topic:3069”]

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

  • What is a binding?
    It is an element provided by JavaScript to hold values. It is also called a variable.

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

  • What is a function?
    It is a piece of program wrapped in a value. Such values can be applied in order to run the wrapped program.

  • Give an example of a function.
    prompt(“Enter Passcode”);
    console.log

  • What is a side effect?
    A side effect is some change to the system produced by a function. (for example showing a dialog box or writing text)

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

  • What is control flow?
    It is the way the statements are executed in a program. IN JavaScript from top to bottom.

  • What is conditional execution?
    It is the way a program runs that depends on a specified condition, and is created with the “if” keyword.

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

1 Like