Binding, Functions and Control Flow - Reading Assignment

  1. It is a fragment of code that produces a value.

  2. To catch and hold values, JavaScript provides a thing called a
    binding, or variable.

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

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

  2. fhfj(’‘gerhtrjrh’’);

  3. A side effect is a part of the program that ‘‘changes the world’’, such as displaying something on the screen , or changing the internal state of the machine in order to change the statements that will come after it.

7.prompt(“Enter passcode”); produces a side effect, and let caught = 5 * 5; produces a value.

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 what is control flow.

  1. A conditional execution is when there is more than one option and the program need to choose the right option according to the criterias.

  2. if

1 Like
  1. What is an expression?

It is a fragment of code that produces a value that is written literally. Expressions can contain other expressions.

  1. What is a binding?

Binding or variable is a thing that JavaScript program use to catch or hold some kind of values. It is triggered by a special keyword -let.It is followed by the name of the binding, by the operator and an expression.

  1. What is an environment?

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

  1. What is a function?

It is a piece of program vrapped in a value.

  1. Give an example of a function.

Prompt. The binding prompt holds a function that shows a little dialog box asking for user input. It can be attached to a string to show some text in that box.

  1. What is a side effect?

When a dialog box or writing text is shown on the screen.

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

alert ("hello to Ivan \n from Ivana”);

// → hello to Ivan

// → it is Ivana

console.log(Math.max(9, 3));

// → 9

  1. What is control flow?

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

  1. What is conditional execution?

It is created with the - if - keyword. If we want some code to be executed if, and only if, a certain condition holds. It is a situation when program takes the proper branch, or flow, based on the situation.

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

It is created using keyword - if.

1 Like
  1. A fragment of code that produces a value is called an expression.
  2. In order to store values on the console we are using the binding option by which we attribute a value to a keyword.
  3. A collection of bindings and their values is called an environment.
  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.alert, prompt, return, console.log
  5. 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.
  6. alert - produces a side effect
    Math.max - produces a value
  7. Control flow expresses the fact that the statements in your program will be executed from top to bottom as a story.
  8. Conditional execution is triggered by the keyword “if” and it makes a code execute only in the eventuality that the condition is fulfilled.
    10.IF
1 Like
  1. What is an expression?
    An expression is a fragment of code that produces a value

  2. What is a binding?
    a binding is when an expression catches and hold value.

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

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

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

  6. What is a side effect?
    Is when a statement is changing the internal state of a machine in a way that it will change the statements that come after it.

  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. A lot of functions are useful because of the side effects they produce.

  8. What is control flow?
    Control flow is when a program contains more than one statement. The statements are executed from top to bottom.

  9. What is a conditional execution?
    This Is an instruction which gets executed only if a certain condition is fulfilled( true ).

  10. What kind of keyword do you need to use to invoke conditional execution?
    If and else are the keywords that you need in order to invoke a conditional execution

1 Like

An expression is anything that produces a value
A binding can be a constant or var define by “let”
An environment is a set of bindings, words and values, used a start of program
A function is an operation using an argument. It is a set of instructions
An example of a function is f(x) = x^2 which the argument of 3 would give a value of 9
A side effect will change the internal function of the machine on the next data set or future statement.
A side effect would be an alert “talk to me” statement that is executed where as for a function that produces a value would be like math.max(1,4,5,7,89,) // -> 89 produces a value
Control flow is sequential logical steps to complete an programs operation
Conditional execution is simply a separate path that can be executed based on conditional if then statements or else statement.
The key words to execute conditional statements are if , then, else, else, else…

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 is used to catch or hold values. Binding has the same meaning than variable in javascript
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. Such values can be applied in order to run the wrapped program
5. Give an example of a function.
console.log(Thesequestionsaresoboring);
6. What is a side effect?
It is when the values of some variables have an effect on other values at a different environment.
7. Give an example of a function that produces a side effect and another function that produces a value.
First one: prompt(“Enter passcode”);
Second one: console.log(Math.min(2,4));
8. What is control flow?
Control flow is the way programs are executed. It executes line by line, from the top to the bottom
9. What is conditional execution?
If loops, they execute only when certain conditions are meant.
10. What kind of keyword do you need to use to invoke conditional execution?
If

1 Like

1 code that produces a value is called expression
2 a program uses a binding or variable holds a value which an change as needed you have to name a binding so that is what it holds
3 bindings and values at one time instructions that interact with browser
4 function is a block of code that performs an action or returns a value.
5 to print greeting so hello world
6 txt box on side is side effect of function (method) a method can have expected/ unexpected side effects desired/undesired reaction
7 ForEach() , ForEachOrdered() and peek() which returns void, are meant to produce side effects.
.forEach(s -> results.add(s));
System.out.println(results);
produces a value
math max produces a value
8 control flow running 2 statements at same time from top to bottom
9 allowing an action to happen if certain conditions met
10 if keyword

1 Like
  1. Any piece of code that resolves to a value.
  2. A pointer that is tied to value and can be disconnected and point to a new one.
  3. Collection of bindings and their values that exist at a given time.
  4. Line of code within a block that can be called as often as needed.
  5. alert(" ")
  6. A function that produces an expression and returns that value.
  7. prompt(" ")
  8. Control flow is the order in which a program will execute a code.
  9. A point where the program decides what to do based on certain conditions.
  10. if
1 Like
  1. What is an expression? An expression is valid intervals in correlation with a single value.
  2. What is binding? Tentacles that connect values
  3. What is an environment? A set of vairables that are binded to their respective values.
  4. What is a function? A function characterizes an specific task that it is set to specific variables.
  5. Give an example of a function? alert (“Economy is transforming”)
  6. What is a side effect? If a function or statement modifies something that it is not supposed to modify then it would be a side effect.
  7. Give an example of a function that produces a side effect and another function that produces a value. console.log(firstAccount);
    var firstAccount = accounts[0];
  8. What is control flow: order in which a program will execute.
    9.What is conditional execution?
    Conditional execution is used when a website has input from a user, it allows the program to behave differently based on different information being entered or manipulated by the user.
  9. What kind of keyword do you need to use to invoke conditional execution?
  • if, else
1 Like

1.Expressions are code that produce a value
2. Bindings is the code that brings the value, operator and expressions together
3. The environment is part of the language standard for the program that allows you to interact with it
4. Function is a piece of program wrapped in value
5. prompt function
6. Writing of text on a screen or a dialog box is a side effect
7. function that produces side effect would be prompt
function that produces value would be console,log math.max
8. It is the order in which the statements are executed from top to bottom
9. It is a IF statement and if those conditions are met then do what is programmed next
10. IF or ELSE

1 Like

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

2.) Bindings are how JavaScript catches or holds new values created from old values in the code.

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

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

5.) A function example would be, “Let” and the word/letter, etc.

6.) a side effect is a return value that gives you writing or a dialog box on the screen.

7.) a.) Prompt (“enter passcode”);
b.) console.log(Math.min(2, 4) + 100);

8.) Control flow is when a program has more than one statement. the statements will be executed as if they were a story, from top to bottom.

9.) A Conditional execution is created with the “if” keyword which in turn allows the program to have multiple paths to choose from, based on certain conditions being met.

10.) The Keyword is “if”

2 Likes
  • What is an expression?

An expression is a fragment of code that produces a value. Perhaps better stated, every value that is written literally, such as a number or “word”, and followed by a semicolon, is an expression. For example: 10; is an expression that is evaluated to the numeric value 10. 10+13; is also an expression that is evaluated to produce the numeric value 23. ‘hello’ + ‘world’; evaluates to the string ‘hello world’, etc.

  • What is a binding?

Imagine bindings as tentacles, rather than boxes, as bindings do not “contain” values, they “grasp” them. A program can access only the values that the binding still has a reference to (a binding points at a value), however, that does not mean it is tied to that
value forever, as simply changing an operator on existing bindings disconnect them from their current value and have them point to a new one.

let luigisDebt = 140;
luigisDebt = luigisDebt - 35;
console.log(luigisDebt);
// → 105

In the example above, the special word (keyword) let indicates that this sentence is going to define a binding, and in this example, the binding is named luigisDebt, followed by an = operator, with the given value of 140, adding the semicolon to end the expression. Though the initial binding to luigisDebt is the value 140, if luigi pays $35 towards the debt, the - operator along with the value 35 and the semicolon create a new expression, changing the binding to luigisDebt from the value 140 to a new value of 105.

  • What is an environment?

The collection of bindings and their values that exist at a given time is called the environment. In a program start up, this environment is not empty, as it
always contains bindings that are part of the language standard, as well as bindings that provide ways to interact with the surrounding system. For example, a browser, has functions to interact with the currently loaded website, to read mouse and keyboard input, etc.

  • What is a function?

Values provided in the default environment have the type function, which is a piece of program wrapped in a value that can be applied (a.k.a. executed or invoked) in order to run the wrapped program.

  • 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 [ like this: prompt(“Enter passcode”); ].

  • What is a side effect?

Showing a dialog box or writing text to the screen is a side effect. A statement that changes the internal state of the application in a way that will affect the statements that come after it are called side effects. An operation, function or expression is said to have a side effect if it modifies some state variable value(s) outside its local environment, that has an observable effect besides returning a value (the main effect ) to the invoker of the operation (any application state change that is observable outside the called function other than its return value).

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

Some functions produce a value, such as power:

const power = function(base, exponent) {
let result = 1;
for (let count = 0; count < exponent; count++) {
result *= base;
}
return result;
};
console.log(power(2, 10));

… and some don’t, such as makeNoise:

const makeNoise = function() {
console.log(“Pling!”);
};
… whose only result is a side effect, as a return statement determines the value the function returns. When control comes across such a statement, it immediately jumps out of the current function and gives the returned value to the code that called the function. A return keyword without an expression after it will cause the function to return undefined, such as the makeNoise example given, which simply returned undefined.

  • What is control flow?

The control flow is the order in which the computer executes statements in a script. A typical script in JavaScript includes many control structures, including conditionals, loops and functions. Parts of a script may also be set to execute when events occur. A simple example:

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

This example has two statements, executed from top to bottom. The first statement asks (prompts) the user for a number, and the second statement is executed after response to the first, which shows the result which is the square of that number given by the user. The function Number converts a value to a number given, as we need that conversion because the result of the prompt is a string value, and we want a number.

  • What is conditional execution?

Conditional execution controls whether or not the core will execute an instruction. Prior to execution, the processor compares the condition attribute with the condition flags, if they match, then the instruction is executed, otherwise the instruction is ignored.

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

Conditional execution is created with the if keyword in JavaScript.

*** However, most often, it would be unlikely that you just have code that executes when a condition holds true, but would also have code that handles the other case. This alternate path is represented by the else keyword. Together with if, you create two separate, alternative execution paths.

3 Likes
  1. An expression is any value e.g 2, 4, 6, 8, “hospital”, and so on
  2. A binding in my understanding could also be referred to as variable, which is a place(memory) where value is stored.
  3. An environment is the collection of binding and value it holds at point in time.
  4. A function is a piece of program wrapped in a value
  5. (a) Prompt(“Enter Your Name”) (b) Alert(“Hello, Ivan”)
  6. Side effect is an action performed outside a program’s scope like pop up alert on screen
  7. Prompt(“Hi Ivan”); and Console.log(Bio.Max(8, 10);
  8. A control flow is the natural sequence of a program from top to bottom.
  9. A conditional execution is a program in which certain condition has to be met during it’s processing
  10. If, If and Else
2 Likes
  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 55 or “lovevegatables”) is an expression. An expression between parentheses is also an expression, as is a binary operator applied to two expressions or a unary operator applied to one.

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

  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.
    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”);

  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.
    Prompt (“enter Password”);
    b.) console.log(Math.min(4, 8) + 50);

  8. What is control flow?
    Control flow is the order in which the computer executes statements in a script. A typical script in JavaScript or PHP (and the like) includes many control structures, including conditionals, loops and functions. Parts of a script may also be set to execute when events occur

  9. What is conditional execution?
    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 .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.

  10. What kind of keyword do you need to use to invoke conditional execution?
    The “if” keyword executes or skips a statement depending on the value of a Boolean expression. The deciding expression is written after the keyword, between parentheses, followed by the statement to execute.

3 Likes
  1. An expression is a snippet of code that evaluates to a value.

  2. Binding creates a new function that will call the original function but with some of the arguments already fixed.

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

  4. Functions give us a way to structure larger programs, to reduce repetition, to associate names with subprograms, and to isolate these subprograms from each other.

function apples(x) {
if (x <= 3) {
return 7;
}
return x * apples(x - 8);
}
apples(3);
  1. Side effects are any state change that can be seen outside of a function call, with the exception of the function return value.

  2. Side Effects:

var makeMoney = function() {
console.log("chi ching!");
};
makeMoney();

Return Value:

var summer = function(hot,warm){
var result = 1;
for(var count = 0; count < warm; count++)
result *= hot;
return result;
};
console.log(summer(2.10));
  1. The control flow is the order in which the computer executes statements in a script.
    The two types of control flows are Conditional execution: If, Else, switch.
    and loop: while, do, for. Break is used to break out the loop.

  2. Conditional execution is where we choose between two different routes based on a Boolean value.

  3. if, else and switch

1 Like
  1. An expression is code that produces a value.
  2. A binding is basically a naming system for values. You ‘bind’ a name to a value or expression and you can use that name in the future to invoke the bound value.
  3. An environment is the current state of bindings at the time of a code’s execution. For example, global variables are part of the environment for every function in a program. Typically, aside from global variables, a function’s environment is distinct and created through its own binding declarations.
  4. A function is a kind of mini-program wrapped into a value. This mini-code can be run by invoking its binding.
  5. Function examples:
    console.log(xyz);
    function myFunction(x){x+2};
  6. A side effect is an effect caused by a function that does something other than change the output value. Storing an output value in a file or changing the appearance of a webpage are examples of side effects.
  7. Produces a side effect:
    function sideEffectFunction(x){console.log(x+2)};
    Produces a value:
    function valueFunction(x){x+2};
  8. Control flow is the order which the program executes. Normal flow goes top to bottom in sequential order. Modifiers like If,else statements can mix up the flow by having the order jump to the if{} or the else{} part of the code based on the input’s value.
  9. Conditional execution use if,else statements to redirect the control flow based on the input value.
  10. “if();” within a function invokes a conditional execution. It can be expanded to if(); else; and further to if(); else if(); else if(); … else();
1 Like
  1. What is an expression?
    An expression is a piece of code that produces a value.

  2. What is a binding?
    A binding is a value or string set to any variable

  3. What is an environment?
    An environment is a collection of variables and their values that exist at a given time call 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(“Good morning!”);

  6. What is a side effect?
    Something that changes the world inside or outside the program.

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

Side effect:
Prompt (Enter Your BEST Email);

Value:
Math.min(2,4) +100;

  1. What is control flow?
    Control flow is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.

  2. What is conditional execution?
    Conditional execution is when you want your program to be executed when certain criteria are met.

  3. What kind of keyword do you need to use to invoke conditional execution?
    In order to invoke conditional execution, you will want to use the keyword “if”.

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

  2. A binding is used to catch and hold value to a name

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

  4. A piece of program wrapped in a value

  5. prompt(“Enter passcode”);

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

  7. prompt(“Enter passcode”);

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

  1. Statements in a program are executed from top to bottom

  2. When the program takes the proper branch based on the situation

  3. if

1 Like

1.An expression is any piece of code that resolves to a value.

2.A binding or a variable is assignment of internal state used to catch and hold values. By using the keyword let before defining a variable lets JavaScript know the sentence is going to define a variable.

3.An environment is set of variables and their values that exist in memory at a given time.

4.A function is named section of a program that performs a specific task.

5.alert(“hello world”)

6.A side effect is a function which produces an expression and returns that value.

let num = 0;
  const func = () => {
    num = 1;
    return true;
  }
  func();

8.Control flow is simply the order in which we code and have our statements evaluated.

9.When using a logical operator to determine wether or not to execute certain parts of the code.

10.‘if’ is the keyword to invoke conditional execution.

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

  2. A binding is used to catch and hold values (remember/save them)

  3. Environment is a collection of bindings and their values.

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

  5. Prompt(“Enter passcode”), prompt function

  6. Side effect is the result/product of the function

  7. a) Prompt(“Enter passcode”), produces a side effect which will be a dialog box asking for a passcode in this case
    b) console.log(Math.max(2,4)), produces a value which is 4.

  8. Control flow is the order which statements are executed when the program contains more than one statement.

  9. Conditional execution is when a code should to be executed if and only if a previous certain condition holds, other wise it is not executed.

  10. IF and ELSE keywords can be used

1 Like