Binding, Functions and Control Flow - Reading Assignment

  1. A fragment of code that produces a value is an expression.
  2. A binding is a variable that maintains a value in an internal state to a value.
  3. An environment is a collection of bindings and their values that exist at a particular given time.
  4. A function is a piece of program wrapped in a value.
  5. “prompt” is an example of a function, though archaic.
  6. “Side Effects” are changes to the internal state of the machine that will affect the statements that come after it.
  7. “prompt” produces a side effect of generating a dialogue box, “console.log” produces a value.
  8. Control Flow is the order in which the code is executed.
  9. Conditional Execution is when the program will behave differently depending on user input.
  10. “if” and “if/else”
  1. A fragment of code that produces a value is called an expression.
    2 binding - connecting two data elements together ( technique to catch and hold values). After a binding has been defined, its name can be used as an expression.
    3.An environment is collection of bindings and their values that exist at a given time. When a program starts up, this environment is not empty. It
    always contains bindings/ Varaibles and their values.
  2. A function is a piece of program wrapped in a value. Such values can be applied in order to run the wrapped program.
    5.prompt(“Enter passcode”); Math.max(2, 4);
  3. expression is said to have side effect if it has an observable effect beside returning a value which is the main effect of the operation.
  4. prompt (“passcode”); - side effect.
    Math.max (2,4,6); - value (6)
  5. Control flow is the order in which we code and have our statements evaluated
    9.conditional execution means that a function/part of a code is going to be executed only when it meets predefined condition
  6. if,else, while, true/false
  1. 1. What is an expression? A fragment of code that produces a value
  2. What is a binding? Also called variable, catches and holds value. A binding points at a value rather than containing it.
  3. What is an environment? The collection of bindings and their values that exist at a given time
  4. 4. What is a function? A function is a piece of program wrapped in a value
  5. 5. Give an example of a function. prompt(“Enter passcode”);
  6. 6. What is a side effect? A statement stands on its own, so it amounts to something only if it affects the world. It could display something on the screen—that counts as changing the world—or it could change the internal state of the machine in a way that will affect the statements that come after it. These changes are called side effects.
  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? 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.
  10. What kind of keyword do you need to use to invoke conditional execution? if
  1. An expression is a fragment of code that produces a value.
  2. It’s where the values are stored to use them later.
  3. An environment is the collection of all the bindings and their values.
  4. A function is a piece of code that gets executed when is called. It can have inputs variables and output variables.
  5. console.log()
  6. A side effect is when an function instead of returning a value, it changes the value of some variable or prints something on the screen.
  7. Side effect - console.log(). Value - Math.max().
  8. It is the way you are going to control the execution of your program.
  9. That if the statement between parenthesis is true, the code between {} will be executed. Else it won’t be executed.
  10. if, else and if else.
  1. Expression is every value that is written literally (in words or/and numbers). Expression + semicolon = statement.
  2. A binding catches and holds values. The word let (also possibly var or const) is used to define that the sentence is going to define a binding.
  3. An environment is a collection of bindings and their values that exist at the same time.
  4. A function is a piece of program wrapped in a value.
  5. Prompt, console.log, alert.
  6. A side effect is It when a statement displays something on the screen—that counts as changing the world—or it could change the internal state of the machine in a way that will affect the statements that come after it. An example of a side effect could be showing a dialog box or writing a text to the screen.
  7. A function with a side effect - prompt. A function of a value - console.log(Math.max(2, 4));
  8. Control flow is an execution of multiple statements - from top to bottom.
  9. Conditional execution is when a program chooses a different way of execution, different way, depending on the current situation.
  10. The keyword if (also - else if; else) is used to use such an execution.
  1. Which type of developer programs the code that users interact with directly?
    (Frontend developers)
  2. In web-development, what languages does a frontend developer typically use?
    (Html, JavaScript, CSS)
  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    (Backend developer) and (Frontend developer)
  4. Which type of developer is responsible for handling databases?
    (Backend developer)
  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    (Ruby) (PHP) (Pyhton)

What is an expression?

Content to produce a value. A expression can contain expressions within it. Expressions make up statements. Kind like how expression is a fragment in English, and statements are sentences.

What is a binding?

Bindings are like tentacles that bind one thing to another. It catches and holds a value.

let caught = 5 * 5;

let indicates that this sentence is going to define a binding.

When a binding points to a value, it doesn’t mean it is tied to it forever. Bindings don’t contain values, they just point to it or grasp it.

Bindings have to start with a letter and can contain numbers. The only symbol it can contain are Dollar signs and underscores. Bindings also can not contain keywords, such as let.

What is an environment?

A collection of bindings and the values that exist at any given time is an environment . When a program starts up, the environment isn’t empty. It contains bindings , which are part of the language standard.

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.

Give an example of a function.

prompt(“Enter Passcode”)

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.

Functions may also produce values in which case they don’t have side effects to be useful.

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

Value

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

// → 4

Side Effect

prompt(“Enter passcode”);

What is control flow?

When a program contains more than one statement the flow is from top to bottom. However with conditional execution, the flow can branch off.

What is conditional execution?

Conditional execution is created with the IF keyword. A code should be executed if a certain condition holds.

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

If

  1. An expression is a set of values, operators, variables
  2. A binding is a link between a variable and a value
  3. Actually I don’t really get what an environment is
  4. A function is a kind of mini program, a piece of code that we can bind with a name and call whenever we need
  5. function example() { console.log(“Here is an example of a function!”); }
  6. A side effect is a console.log print
  7. function sideEffect() { console.log(“This is a side effect”); }
    function square(x) { return x * x; }
  8. Control flow is the way to make decision for instance: if (x % 2 == 0) console.log(“x is even”);
  9. age >= 18 ? adult : child;
  10. if else while or the ternary operator ?
  1. An expression is a fragment of code that produces a value.
  2. A binding catches and holds values.
  3. An environment in a collection of bindings and their values that exist a a given time.
  4. A function is a piece of program wrapped in a value.
  5. console.log
  6. A side effect is something that can be produced by a function.
  7. prompt(“Enter passcode”); -------- console.log(Math.min(2, 4) + 100);
    // → 102
  8. Control flow executes the statements from top to bottom in a program.
  9. Conditional execution will allow a program to take a certain path based on the situation at hand.
  10. If will be used to invoke the conditional execution.
  1. Fragment of code that produces a value
  2. A binding / variable catches and holds a value for future use
  3. A collection of bindings and their values
  4. A piece of program wrapped in a value
  5. “console.log” = This outputs your values
  6. Showing a dialog box or writing text to the screen
  7. Side effect = “alert” (produces pop up window); Value = “Math.max”
  8. The order in which your program is executed. If the “straight-line control flow” is employed, then this will be from top to bottom.
  9. Conditional execution is based on the situation at hand instead of the linear program stated in question 8. That is, a branching road may be utilised to execute the program instead of reading it from top to bottom.
  10. The “if” keyword is necessary to invoke conditional execution.
  1. What is an expression?
    Some code that produce a value.
  2. What is a binding?
    The link between a value and a name, used to store 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 function is a piece of program wrapped in a value.
  5. Give an example of a function.
prompt("Enter name");
  1. What is a side effect?
    Changes that are produced by statements and affects the world.
  2. Give an example of a function that produces a side effect and another function that produces a value.
Alert("Hello World");
math.max(5,9);
  1. What is control flow?
    The way the statements are executed.
  2. What is conditional execution?
    When the program takes the proper way based on a situation.
  3. What kind of keyword do you need to use to invoke conditional execution?
    if
  1. What is an expression?
    A fragment of code that produces a value.

  2. What is a binding?
    A piece of code that holds a value.

  3. What is an environment?
    Collection of bindings and their values

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

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

  6. What is a side effect?
    side effect is 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.
    i. prompt(“Enter your Name”);
    ii. console.log(Math.max(2,4));

  8. What is control flow?
    Statements in a program are executed just like in a story i.e from top to bottom.

  9. What is conditional execution?
    branching roads or flow in a program based on the situation at hand.

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

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

  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.

  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 is a side effect.

  7. prompt(“Enter passcode”); and console.log(Math.max(2, 4));

  8. The order the statements in the program are executed - left to right and top to bottom.

  9. Conditional execution is a special order of statements execution when some code is executed if, and only if, a certain condition holds.

  10. if, else

  1. What is an expression? A fragment of code that produces a value.
  2. What is a binding? A way 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(Math.max(2, 4));
  6. What is a side effect? Results produced by expresions or functions.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“Enter passcode”);
    console.log(Math.max(2, 4));
  8. What is control flow? The order code/statements are executed.
  9. What is conditional execution? Execution of the code that is not straight; the program takes the proper branch based on the
    situation at hand.
  10. What kind of keyword do you need to use to invoke conditional execution? If, else, else if.
  1. A fragment of code that produces a value.
  2. Bindings allow you to catch and hold values and should be imagined as tentacles rather than boxes. They do not contain values they grasp them.
  3. A collection of bindings and values at any given time is know as the environment.
  4. A function is a piece of program wrapped in a value. It performs a specific task.
  5. The binding prompt holds a function that shows a little dialog box.
  6. An observable change outside the called function other than its return value.
  7. prompt(“Enter Passcode”); - Dialog box as observable side effect
    console.log(Math.max(2, 4)); - Highest value 4 is shown but no observable side effect
  8. The order in which our code is evaluated - Statements are executed from top to bottom.
  9. 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.
  10. If, Else.
  1. What is an expression?
    a fragment of code that produces a value
  2. What is a binding?
    a variable that catches and holds values e.g. let number = 5 * 5
    let is a keyword that assigns the arbitrarily-named variable, number, the same value as 5 * 5
  3. What is an environment?
    The collection of bindings and their values that exist at a given time
  4. What is a function?
    a wrapped section that performs a specific task
  5. Give an example of a function.
    console.log(“I love IvanOnTech”)
  6. What is a side effect?
    any change in the environment other than the return value of a function or expression e.g. 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(“enter username”); - produces side effect of dialogue box
    console.log(Math.max(2,4,6)); - returns the value 6
  8. What is control flow?
    the order in which your program is executed
  9. What is conditional execution?
    the program does not follow a straight line and branches to different lines of code based on inputs
  10. What kind of keyword do you need to use to invoke conditional execution?
    if and else
  1. What is an expression?
    -A fragment of code that produces a value.

  2. What is a binding?
    -A variable or word that catches and hold a values.

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

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

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

  6. What is a side effect?
    -A change in the environment that isn’t a return value of a function; showing a dialog box or written text to the screen.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Side-Effect:
    -prompt(“Hello World!”);

Function:
console.log(Math.max(2,4));
// 4

  1. What is control flow?
    -The execution of a list of statements in order from top to bottom.

  2. What is conditional execution?
    -A list of rules set out in case a certain condition is met. Program not following the typical branches based on the input of the user.

  3. What kind of keyword do you need to use to invoke conditional execution?
    -Keyword “if” & “else” beginning the line of code with this will invoke the conditional statement.

1.What is expression?
A fragment of code that produces a value is called an expression.
2. What is binding?
Catch and hold values and preventing them from dissipating.
3. What is an environment?
A collection of binding and their values that exist at a given time.
4.What is a function ?
A piece of program wrapped in a value.
5.propmpt (“EnterPassword”);
6. What is a side effect ?
A statement that counts as changing the world.
7.Give an example of a function that produces a side effect and another function that produces a value.
side effect:
let ten=10; console.log(ten*ten);
value:
var=x;
x=5
8.What is control flow?
When writing program -the statements are executed from top to bottom.
9.What is conditional execution?
When the program takes the proper “branch” based on the situation at hand.
10. What kind of keyword do you need to use to invoke conditional execution?
(if)-execute or skips statement.
(else)-choose alternate pass.

  1. An expression is a code that gives us a value.
  2. Binding is a way to store a piece of information with a certain name.
  3. All bindings and their values make out an environment.
  4. Function is a specific piece of code that requires some input values to execute its own code.
  5. function powerof3(number) {
    return numbernumbernumber;
    }
  6. A visual change on a webpage.
  7. Alert produces a side effect, while console.log(2*2) produces a value.
  8. A flow in which the program will be executing our code.
  9. It is a condition in which a code has 2 or more paths to take depending on the input values the code gets.
  10. Lowest form is with If and atleast 1 Else.
  1. What is an expression?
    Something that returns a value

  2. What is a binding?
    A pointer to a value of a variable

  3. What is an environment?
    Collection of bindings and their values existing in a given instance

  4. What is a function?
    An expression wrapped in a value.

  5. Give an example of a function.
    console.log(“this is a function”)

  6. What is a side effect?
    An observable change in the state of the application.

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

  8. What is control flow?
    The execution flow of expressions.

  9. What is conditional execution?
    A moment in the program where it decides what it have todo.

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