Binding, Functions and Control Flow - Reading Assignment

1 What is an expression?
Expression is a fragment of code that produces value.
2 What is a binding?
Binding names can be any, word, digits, valid names but names cannot start with a digit,
3 What is an environment?
An environment is a 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.
let x = 30;
console.log(“the value of x is”, x);
// → the value of x is 30
6 What is a side effect?
A side effect is a result of an impure function.
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.
When the function Math.max takes any amount of number arguments and gives back the greatest.
8 What is control flow?
Control flow is the story in a program.
9 What is conditional execution?
When a certain condition is met in a dialogue, the program could branch into another path- this is called conditional execution.
10 What kind of keyword do you need to use to invoke conditional execution?
The key word that is used to invoke a conditional execution is: “if”

1 Like
  1. An expression is a fragment of code that produces a value. Every value that is written literally is considered an expression.

  2. A binding is a variable that JavaScript uses to catch and hold 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 program wrapped in a value.

  5. An example of a function is the prompt function.

  6. A side effect is a process of showing a dialog box or writing text to the screen.

  7. An example of a function that produces a side effect is the Math.max function. Math.min is a function that produces a value.

  8. Control flow occurs when your program contains more than one statement. The statements are executed from top to bottom, as if they are written as a story.

  9. Conditional execution occurs when the program takes the proper branch based on the situation at hand.

  10. To invoke conditional execution, you need to use the if keyword.

Thank you!

1 Like

I have now found out that the invoke conditional execution is “if”

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

  2. What is a binding?
    Pointing a value to a variable

  3. What is an environment?
    A collection of bindings and Their values in a program

  4. What is a function?
    A piece of code That you can execute as often as youd like

  5. Give an example of a function.
    Prompt, console.log;

  6. What is a side effect?
    The effect a function has outside Its own scope to other values

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Side effect- console.log (“Hello”);
    Value: Var a = 2;

  8. What is control flow?
    The order in Which Your functions Are executed

  9. What is conditional execution?
    An if/or statement before executing a function

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

1 Like
  • A fragment of code that produces a value is called an expression
  • Binding is a named piece of memory containing some data inside.
  • The collection of bindings and their values that exist at a given time is called
    the environment.
  • Named piece of program that does something predefined
  • alert(“Hello world”);
  • Its something that happens after invoking a function, for example alert gives you an alert
  • alert(2);
    1+1
  • The direction the computer reads the code, top to bottom, row to row, left to right
  • Its a way of going around that previous route, for example if this is not true, then skip this part
  • if
1 Like
  1. Is a fragment of code that produces a value, they can also contain other expressions, which allows us to build other expressions that describe arbitrarily complex computations.

  2. Is a variable that catches and holds values.

  3. Is the collection of bindings and their values that exis at a given time.

  4. A function is a piece of program wrapped in a value, which the values that are provided in the default environment have the type “function”.

  5. prompt(“Enter passcode”);

  6. Is a type of function that shows a dialog box or writing a text to the screen.

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

  8. It is the order that the statements of a program gets their code executed from top to bottom.

  9. It is the way that the program decides or behaves towards the situation it is facing, allowing different type of information entered or manipulated by the user.

  10. It is created with the “if” keyword in JavaScript.

2 Likes
  1. An expression is value generated by a fragment of code.
  2. Binding is attaching a value to a variable to be able to use it later on
  3. The environment is the minimal bindings and data that exists at startup
  4. A function is a piece of program wrapped in a value, executing given tasks with given data.
  5. A function that tells you how old where you 10 years ago, it’s given the age number and it reduces 10 to give the return.
  6. A side effect is showing dialog box or writing text to the screen.
  7. Side effect: Greeting a user that just entered the site
    Value: not sure how to constract it in my head
  8. Control flow keeping code and tasks in 1 order so the program is predictable and making sense.
  9. Conditional Execution is isolating a specific path to go by, based on the situation at hand.
  10. If

This one was touuughhhh

1 Like
  1. A fragment of code that produces a value is called an expression
  2. Binding a variable to a value that it holds starts with let. Example:
    let ten = 10;
    console.log(ten + ten);
    // 20
    var and const can also be used to create bindings
  3. The collection of bindings and their values that exist at a given time is called the environment
  4. Functions are pieces of a program wrapped in a value.
  5. Example:
    The binding alert holds a function that brings up a popup box.
    FYI: Execution of a function is called invoking, calling or applying.
  6. Showing this popup box is called a side effect of that function
  7. The prompt function produces a textbox as side effect.
    math.max just returns the maximum value without any side effects.
  8. The control flow determines the order in which a program runs the containing statements
  9. Conditional Execution does not run the statements linear, but depending on conditions.
  10. The keyword “if” executes or skips a statement depending on the value of a boolean expression
1 Like
  1. What is an expression?
    Anything that produces a value is an expression in JavaScript.

  2. What is a binding?
    A binding is a variable that JavaScript uses 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.

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

var x = function (a, b) {return a * b};

  1. What is a side effect?

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

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

Side Effect:
prompt(“Enter passcode”);

Value:

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

  1. What is control flow?

It is basically the order in which the statements are executed.

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

  1. 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.To catch and hold values called binding.
3 .Environment is the values and bindings existing at a time.
4.The collection of bindings and their values that exist at a given is called the environment.
5.Function add (let a, let b) {return a+b;}
6.A side effect is a functions influence to the world, for example a function which shows a text on a screen.
7.Prompt(“Hello World”); function add (let a, let b) {return a+b;}
8.Control flow means, that the statements in a program are executed from top to bottom.
9.Conditional execution happens, by using conditions like if, while, do in a program. Conditions can interupt the straight flow of statements in the program.
10. if

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

  2. What is a binding?
    it binding object to function and reference it by using ‘this’

  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 program wrapped in a value. Executing a function is called invoking, calling, or applying it.

  5. Give an example of a function.

function testfunction (p1, p2) {
return p1 * p2;
}

  1. What is a side effect?
    a side effect is an alteration outside the scope of the function so if your function returns anything outside of its environment that called a side effect

  2. Give an example of a function that produces a side effect and another function that produces a value.
    side effect: Logging to the console
    value : math.max

  3. What is control flow?
    it controlling the way or order of the execution in the program (Conditional execution, while, loops …)

  4. What is conditional execution?
    created with the if keyword and program takes the proper branch based on the
    situation at hand.

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

1 Like

Excellent answer @Matea ! Thank you for your first post. Welcome aboard. Hope to see you here frequently. If you have any doubts or questions please feel free to reach us out. We’re here to help! :smiley:

Happy Learning!

2 Likes
  1. An expression is a fragment of code the produces a value

  2. A binding references a variable to a value

  3. An environment is the collection of bindings and their values at a given time

  4. A function is a piece of program wrapped in a value that can be called to perform a specific task

  5. prompt("Enter passcode);

  6. A side effect is a change in the world caused by an expression

  7. console.log(“hello”); // produces a side effect - displays something on the screen
    Math.max(2,4); // produces a value

  8. Control flow is the sequential order of execution of statements

  9. Conditional execution means branching the control flow depending on specific conditions at hand

  10. IF can be used to invoke conditional execution

1 Like
  • What is an expression?
    An expression is a bit of code which looks to resolve to produce an value
  • What is a binding?
    Binding is connecting a variable value to a name tag which can be invoked in a code by the tag name
  • What is an environment?
    An environment is a collection of bindings at a given time
  • What is a function?
    A function is a piece of code which can be invoked by using its function names and arguments
  • Give an example of a function.
    function algebra (a, b) {
    return a * b;
    }
  • What is a side effect?
    A return value from the function which is outside of its environment such as text on a screen
  • Give an example of a function that produces a side effect and another function that produces a value.
    side effect - console.log(5) or alert prompt to sign in
    Value - math.min function
  • What is control flow?
    Sequential order in which statements are executed by the program
  • What is conditional execution?
    When options branch out in different directions such as if/else statements on specific conditions provided
  • What kind of keyword do you need to use to invoke conditional execution?
    if Keyword
1 Like
  1. A fragment of code that produces a value
  2. Binding is how javascript catches and holds values after calculation to keep it from disappearing
  3. An environment is a collection of bindings and their values at a given point of time
  4. A function is a part of a program made of values
  5. Answering a pop up prompt or a filling a form box and clicking enter
  6. A side effect is changing a statement so that effects the statements that follow afterwards
  7. side effect prompt(“pick a number 1-10”)
    value ten = 10
  8. Control flow is executing multiple statements in a top to bottom order
  9. Conditional execution is created with the keyword “if” where the code is executed if and only if
  10. if and else
1 Like

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

What is a binding?
A way to store a command into the program using LET. A binding also can be called a variable.

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

What is a function?
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.
A full greetings ("Hello, my name is…)can be a function. You can put the function in a different part of the program. The function(greeting)can be invoked in every other part of the program

What is a side effect?
If a program not just produce a value but als changes the internal state of the machine in a way that will affect the statements that come after it.

Give an example of a function that produces a side effect and another function that produces a value.
Example of a function that producer a side effect
Var a = 1;
Var b = a++;
Site effect is in var b where there is an additional calculation

Sample of a function that produces a value
(Math.max (7, 14) + 30);
37

What is control flow?
Controle flow is the order that statements are executed in the program. From top to bottom.

What is conditional execution?
Is the execution of a statement IF certain conditions are met.

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

1 Like
  1. What is an expression?

A fragment of code that produces a value

  1. What is a binding?

A way to store a variable that can be called upon during a program. The value of the binding can be changed.

  1. What is an environment?

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

  1. What is a function?

A piece of program wrapped in a value. Values given to functions are called arguments

  1. Give an example of a function.

Math.max()
This function takes any amount of number arguments and returns the greatest value on screen

  1. What is a side effect?

Showing a dialog box or text on screen

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

The Prompt function produces a side effect in the form of a dialog box.
Math.max function produces a value

  1. What is control flow?

The order that statements are executed by a program.

  1. What is conditional execution?

A control flow where the program has multiple possible execution paths. The program takes the appropriate branch based on the situation at hand.

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

if and else

1 Like

1 - An expression is any code that produces a value.
2 - Binding is used in software when we need to save a value inside a variable, this variable will be also saved in the system memory making possible to be reutilized in the future.
3 - An environment is a collection of variables existing in a determinate time, for example starting up a system with Javascript will bring standart variables from the language, which is called environment.
4 - Functions are blocks of codes that receive a value and work on it, usually returning a new value.
5 - function mySum(number) {
var result = number + 1;
return console.log(result);
}

	mySum(3);

6 - A side effect when a programmer writes a code that can produces a change on the system behavior.
7- An example of side effect is code below:

var num1 = 1
while(num1 <= 2){
console.log(“Side effect”);
}
8 - Control flow is the order that will be followed during the execution of the code. The order is from to the top to the buttom.

9- A conditional execution is a piece of code that tells the computer to execute an action only if some condition is respected.
ex:

var myAge = 22;
var legalAge = 21;

	if (myAge >= legalAge) {
		console.log("Cheers!");
	}
	else {
		console.log("I can't give you any beer :(")
	}

10 - The keywords necessary to invoke a condition are IF, ELSE

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

  2. Binding is basically referred to as value assigned to variable or string.

  3. Environment is collection of all bindings and their values at a given point of time.

  4. Functions are section of programs that perform specific task.

  5. console.log()

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

  7. alert() and console.log()

  8. When we have more than one statement, then execution flow is from top to bottom.

  9. Point where program acts acc. to certain conditions.

  10. if keyword

1 Like

Homework: Binding, Functions & Control Flow

  1. A fragment of code that produces a value. Expressions can also contain other expressions. A program is a list of statements and the simplest kind of statement is an expression.
  2. bindings are used to capture old values so they can be referenced later and used again. Example bindings are var (variable) const (constant) let (let).
  3. The environment is a collection of bindings and their values that exist at a given time.
  4. Function is a piece of the program that is wrapped in a value. Such functions can be called to run specific programs. When functions are called they produce side effects and values.
  5. prompt()
  6. Side effect are changes in the program, screen or state of the machine.
  7. console.log() produces a side affect - shows something on the screen. Math.max produces a value.
  8. Control flow it the order that the code is interpreted by the machine. From top to bottom unless the code and specific conditions are met to change course or flow.
  9. if a specific condition is met then conditional execution occurs changing the flow of the program.
  10. if / else
1 Like