Binding, Functions and Control Flow - Reading Assignment

Q1.What is an expression?

A1. An expression is a fragment of a code that produces a value. Expressions can be layered with other expressions making larger expressions.

Q2. What is binding?

A2. A binding is a value or string set t a variable, it helps to make bindings, so you don’t have to write out the same expression multiple times in the program.

Q3.What is an environment?

A3. An environment is all of the bindings that have been made within a program.

Q4. What is a function?

A4. A function is a section of the program that performs a specific task. It can then be called upon for use in other expressions

Q5. Give an example of a functio.

A5. - ALERT(“THis message will self destruct”);

Q6. What is a side effect?

A6. A side effect is an observable change in the state of the application.

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

A7. alert(“alert is a function that produces a side effect”) console.log(2+4); produces a value

Q8. WHat is control flow?

A8. The order of executing code from top to bottom, left to right.

Q9. WHat is conditional executio?

A9. WHen using a logical operator to determine wheter or not to execute certain parts of the code.

Q10.WHat kind of keyword do you need to use to invoke conditional execution?

a10. - If it is the keyword to invoke conditional execution.

1 Like
  1. A piece of code that produces a value;

  2. Bindings are statements of code that “associates” a value and a variable.

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

  4. Is a piece of program wrapped in a value, a function can be called by its defined name to perform a certain task.

  5. Console.log(“Hi there!”);

  6. A side effect is a state change performed by a function that is noticed outside its scope.

  7. Side effect example: alert(“Hello, world!”);
    Value example: console.log(2 + 2);

  8. Control flow is the way or order the program is executed. In Javascript it is top to bottom.

  9. A conditional execution is the way we order a program or function to evaluate a condition and perform based on it.

  10. Keywords like if, else, while…

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

2.What is a binding?
Binding stores a particular value to use it for later. They do not contain values; they grasp them—two bindings can refer to the same value

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

  2. What is a Function?
    A function is a puce of program wrapped in a value

  3. Give a function example
    prompt - uses the string that it was given as the text to show in a dialogue box
    consol.log

  4. What is a side effect?
    Any application state change that one can see outside the called function other than the return value. i.e showing a dialogue box or writing text to the screen

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

1 Like
  1. What is an expression?
    A fragment of code that produces a value is called an expression .
  2. What is a binding?
    making a work or phrase hold information like a multiplication equation
  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.
    the binding prompt holds a function that shows a little dialog box asking for user input.
  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.
    Showing a dialog box or writing text to the screen is a side effect .
  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?
    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?
    the if keyword
1 Like
  1. An expression is any fragment of code that creates a value.

  2. A binding is a method to store the value of an expression after it has been created.

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

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

  5. A common function in javascript is the console.log function, which returns the value of the expression contained within it.

  6. A side effect is produced when a statement creates changes the internal state of the machine in a way that effects the statements that follow it, or the state of the world around it.

  7. Produces a side effect:
    prompt (“Enter Password”);

Produces a value:
console.log(“Enter Password”)

  1. Control flow is the direction that your program follows during its execution. It is generally linear, top to bottom, unless there are conditional executions within your code.

  2. Conditional execution is a different type of control flow which allows your program to follow a different set of statements based on the certain conditions.

  3. Conditional execution is created using the keyword “if”.

1 Like

1.) An expression is a fragment of code that produces a value.
2.) A binding catches and holds old values.
3.) An environment is a 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(“enter passcode”);
6.) A side effect is a change to the world made by a statement, e.g. showing a box or writing text on the screen.
7.) console.log(math.max x,y)produces a value.
Prompt(“enter name”) produces a side effect.

8.) a control flow is the direction a program operates toward.
9.) A conditional execution is “a branching road, where the program takes the proper branch, based on the situation at hand.”
10.) If.

1 Like
  1. An expression is a fragment of code that expresses a value.
  2. Binding are keywords that catch and hold value.
  3. Environments are collections 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 name”);
  6. A side effect is showing a dialogue box or writing text to the screen.
  7. alert( “this is a side effect “);
    console.log( 9 + 8 );
  8. Control flow is the order programs are executed ,top to bottom.
  9. Conditional execution code is executed If certain conditions hold.
  10. Conditional execution keywords ( If , else )
2 Likes
  1. Part of a code that produces a value.
  2. variables that hold values for you.
  3. The collection of the bindings
  4. it is a program that is wrapped in a value.
  5. alert()
  6. When a function or expression presents something other than a value like a dialog box.
  7. Dialog box, Math.max
  8. code is read from top to bottom
  9. If this is true THEN do this.
  10. IF, oh the magical, the powerful “IF”
1 Like

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

What is a binding?
To catch and hold values, JavaScript provides a thing called a binding that catches and holds values.

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

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

Give an example of a function.
prompt(“Enter password”);

What is a side effect?
A side effect is 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.
console.log(Math.max(2, 4)); // → 4

console.log(Math.min(2, 4) + 100);// → 102

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.

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

What kind of keyword do you need to use to invoke conditional execution?
if’ is the main keyword to invoke conditional execution.

1 Like
  1. A fragment of code that produces a value is called an expression.
  2. A binding catches and holds a value.
  3. An environment is a collection of bindings and their values at a given time.
  4. A function is a piece of program wrapped in a value.
  5. prompt(“Enter password”); will popup a dialog box asking for the user’s password.
  6. prompt(); is a function that produces a side effect. Console.log(Math.max(2,4)); is a function that produces a value.
  7. Your program is executed from top to bottom.
  8. Conditional execution is a part of the code that is executed only if the proper conditions are met.
  9. if
1 Like
  1. An expression is a piece of code that produces a value. Expressions can contain other expressions like sentence and subsentence in human language. This means that multiple expression allow to describe a more complex computational requirement. In JavaScript more expression linked together create a statement.
  2. A binding is a way to store a value into the program’s memory. To define a binding in JavaScript it is used the statement “let”, followed by and “=”. Once the binding is defined it can be used into an expression. It’s important to say that a binding is not linked forever to the same value. Once define the name, any time I put the “=” operator I can disconnect a binding to the current value and give link it to a new one.
  3. A collection of bindings with their values at certain time is called environment. Usually when a program starts the environment is not empty, it contain already a bunch of binding previously defined.
  4. A function is a piece of program wrapped in a value, that can be called during the coding. Usually some of this value, with the type “function”, are already been defined in default environment.
  5. “console.log” is a kind of function that shown as text on the device the argument of the function.
  6. Showing a text or dialog box on the screen is called “side effect”. Functions are usually used to produce a side effect.
  7. “console.log” is a function that produce as side effect that any argument written between the two parenthesis is shown at screen. The function “math.max” instead produce a value. In particular it shown between a series of number the greatest.
  8. When a program contains more than one statement, each of them are executed starting from the top to the bottom of the program’s code.
  9. When during the program I want to create a branching road, where a two or more values produce different effect, I’m creating a conditional execution. An example if with the function “if”. If A do this, else do that.
  10. The most important conditional execution keyword is “if”. It can be used to execute a statement if and only if a condition is verified. Or I can decide to list different statement based on which condition is true, using also “else” keyword.
1 Like
  1. What is an expression?
    It is a piece of code that put together creates a value. The value can be a number, a string or a logical value.

  2. What is a binding?
    Binding connects variable and its value. It holds values or is available for later use

  3. What is an environment?
    binding is a variable. It holds a defined value and can be used as an expression like “let” “var” and “const”.

  4. What is a function?
    Piece of code wrapped in a value is a function. In browser environment, binding prompt holds a function that shows a little dialog box asking for user input.

  5. Give an example of a function?
    A little dialog box asking for user input, like " enter your name". prompt(“Enter your name?”)

  6. What is a side effect?
    Ex of side effect: prompt, alert, console.log

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

Side effect: alert(“Hello world!”);
A value; math.random();

  1. What is control flow?
    Control flow is the order in which the computer executes statements in a script.

  2. What is conditional execution?
    A function that decides what to do in the program depending on given value or condition.

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

1 Like
  1. an expresion that returns a value

  2. it holds vaues

  3. it is a collections of bindings

  4. a wrapped section that preforms a specifik task

  5. alert(“hello world”)

  6. its a change in the sustom

  7. one thig hapens after anuter and so on

  8. its a brance that he program coses on path

  9. if

1 Like
  • What is an expression?

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

  • What is a binding?

Bindings catch and hold values so they do not dissipate. We name bindings by using keywords such as const, var and let. Binding names can be added to values and expressions.

For example
Name = “Alex”;
MentalAge = (2*5)+2;

  • What is an environment?

A collection of bindings and the allocated values that exist at a given time is called the environment . When a program starts up, this environment is not empty. It always contains bindings that are part of the language standard, and most of the time, it also has bindings that provide ways to interact with the surrounding system.

  • What is a function?

A function is a piece of program wrapped in a value. We can call a function anytime by calling it.

  • Give an example of a function.

Prompt(“Enter Name”)
Alert(“Loving the academy”)

  • What is a side effect?

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.

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

Side Effect - Alert(“Black coffee, no sugar, as always”);
Value - Math.max(100,500);

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

  • What is conditional execution?

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

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

If, else

2 Likes
  1. What is an expression?
    It’s a fragment of code that produces a value. Expressions can contain other expressions to describe arbitrary complex computations.

  2. What is a binding?
    A binding or variable, are used to catch and hold values.

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

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

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

  6. What is a side effect?
    It’s when a statement or function modifies the state of something else outside its own scope.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    alert("side affect"); var address = accounts[0];

  8. What is control flow?
    It’s the direction of execution of code(top --> bottom)

  9. What is conditional execution?
    Functions created with ‘if’ and are able to go through different executions depending on the conditions put in place.

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

1 Like

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

2 - Binding is a thing which JavaScript provides to catch and hold values.

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

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

5 - In a browser environment, the binding prompt holds a function that shows a little dialing box asking for user input.

prompt(“Enter passcode”);

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

7 - console.log (“Hi,Ivan!”)
// “Hi,Ivan!” printed at the browser console.

console.log(Math.min (4,8)+100);
// ==> 104

8 - The control flow is the order in which the computer executes statements in script.

9 - Not all programs are straight roads. We may want to create a branching road, where the program takes the proper branch based on the situation at hand.

10 - if, else if , else

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

  2. A binding is a variable provided by JavaScript to catch and hold values.

  3. In JavaScript, 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. An example of a function in JavaScript would be “console.log.”

  6. A side effect in JavaScript is the effect of functions, such as writing text to the screen or showing a dialog box.

  7. A function that produces a side effect would be “alert.” A function that produces a value would be “console.log.”

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

  9. Conditional execution is code that is executed only if a certain condition is met or held.

  10. The keyword required to invoke conditional execution is “if.”

1 Like
  1. What is an expression?
    When a code fragment produces value.

  2. What is a binding?
    The special keyword “let” allows us to make a binding in Javascript.
    Example: let “ten” = 10
    The name “ten” can now be used as an expression, and the value of that expression is now 10.
    ten = 10

  3. What is an environment?
    A collection of bindings and their values that exists at a given time is called environment.

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

  5. Give an example of a function.
    console.log(Math.max(2, 4));
    // → 4

  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.

console.log(Math.min(2, 4) + 100);
// → 102

prompt(“Enter passcode”);

  1. What is control flow?
    The control flow is the order in which the computer executes statements in a script.

  2. What is conditional execution?
    Conditional statements are used to perform different actions based on different conditions. When you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.

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

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.
  • You should imagine bindings as tentacles, rather than boxes. They do not contain values; they grasp them—two bindings can refer to the same value. A program can access only the values that it still has a reference to. When you need to remember something, you grow a tentacle to hold on to it or you reattach one of your existing tentacles to it.
  1. What is an environment?
  • The collection of bindings and their values that exist at a given time is called
    the environment.
  1. What is a function?
  • A function is a piece of program wrapped in a value.
  1. Give an example of a function.
  • prompt(" ");
  • It holds a function that shows a little dialog box asking for user input.
  1. What is a side effect?
  • This is when a statement changes the internal state of the machine in a way that affects the statements that come after it. 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.
  • The alert function produces a value that is hard coded.
  • The prompt() function requests the user to enter a value which you can then feed into the alert() function to output the data entered.
  1. 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. This is how the program flows. For example you prompt() a user to enter their first name, then below the prompt(), you take the value entered and you display an alert() with their name. In this case, if you write the alert on top of the prompt, you will not get the users name because the alert will appear first then the prompt afterwards.
  1. What is conditional execution?
  • We may, for example, want to create a branching road, where the program takes the proper branch based on the situation at hand. This is called conditional execution.
  1. What kind of keyword do you need to use to invoke conditional execution?
  • if, else if, else.
1 Like
  1. An expression is a piece of code that produces a value.
  2. A binding, or variable, is the store of a value (that can vary depending on the data passed to a program or function).
  3. The environment is the list of bindings (with corresponding values) within a program at a given time.
  4. A function is a bound piece of program wrapped in a value.
  5. Console.warning()
  6. Side effects are additional actions produced by a function.
  7. Producing a side effect: alert()
    Producing a value: toUpperCase()
  8. The control flow is the order in which functions and statements of a program are evaluated/executed.
  9. It is a set logical rules that determine the control flow when the program/function is executed, depending on a given condition (or conditions).
  10. “if”
1 Like