Binding, Functions and Control Flow - Reading Assignment

  1. An expression is - a fragment of code that produces a value
  2. Binding uses the keyword let to define it & can also be called a variable
    3.The environment is a collection of bindings & their values
  3. A function is the word for alot of the values in the default environment; it is a piece of program wrapped in a value
  4. An example of a function is in the browser’s environment it is common to use the binding/variable prompt (enter passcode)*
  5. A side effect is what makes a statement useful. It displays something on the screen, or changes the internal state of the machine in a way that effects the following statements
  6. A function that produces a side effect:
    alert(“hello”)
    A function that produces a value:
    console.log(Math.max(2,4))
    // ->4
  7. Control flow is when a program contains more than one statement & those are executed as a story, from top to bottom
  8. Conditional execution is used to create a branching road
  9. To invoke conditional execution we use the keyword if
1 Like
  1. Any piece of code that returns a value.
  2. Bindings are used to catch and hold values.
  3. The collection of bindings and their values that exist at a given time.
  4. A piece of program wrapped in a value. Values can be applied in order to run a wrapped program.
  5. math.max
  6. Showing a dialog box or writing text to the screen are examples of a side effect.
  7. prompt(“Name?”); math.max(2,4);
  8. The order of executing code from top to bottom left to right.
  9. Program takes the direction based on the situation.
  10. else if
    else
    if
1 Like

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

What is a binding?
Binding is a route to a value.

What is an environment?
Collection of bindings and values at a given time.

What is a function?
Little program wrapped in a value.

Give an example of a function.
prompt(“This box wants your input:”)

What is a side effect?
Anything other then a value produced by a function.

Give an example of a function that produces a side effect and another function that produces a value.
prompt(“This box wants your input:”); //side effect is a prompt box
Math.max(1, 21); // no side effect. only returns a value

What is control flow?
We use control flow to create branches in code execution from top to bottom.

What is conditional execution?
Part of code gets executed when conditions are met.

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

1 Like
  1. An expression returns a value
  2. Binding is when you point/reference a variable to a value
  3. Environment is the the collection of bindings and their values at that point in time of the programs existence.
  4. A function is a group of code that can be called by the program to compute a value
  5. isNan() is a global function example… used to evaluate if a value is an illegal number
  6. Side effect is a statement result that changes something that affects the program
    7.isNan() would produce a value, Number() would produce a side effect by converting a value to a number
  7. Control flow is the way the program is executed. Javascript control flow is top to bottom like humans read a page.
  8. Conditional execution is like a fork in the road. The program uses if, else, if else to evaluate a condition and continue executing the branch of code based on the value returned from that condition.
    9.Conditional Execution is a branch in the control flow’s execution, where JavaScript picks a branch depending if the conditions that are present.
  9. if’ is the keyword to invoke conditional execution.
1 Like
  1. An expression is a bit of code that produce a value. Anything that produces a value can be used as expression. Functions can also be used as part of a expression because they produce values
  2. A binding is a declaration of the value of variable such as let a = 10
  3. An environment is the collection of Bindings and their values that exists in a given time in the considered code.
  4. A function a special type of value which holds a piece of program. These type of values are provided by the default JS environment
  5. alert() is a function which makes a small window appear with the designated text.
  6. A side effect is any change that is observable other than the called function return value
  7. the function prompt() makes appear a dialog box as side effect. The function Math.Max() return the maximal value of a set of defined values.
  8. Control flow is the direction that the program uses to read statements and expressions
  9. A conditional execution is piece of code that will be executed only if a certain condition is met
    10.To invoke conditional execution the keyword if is used
1 Like
  1. expression - a fragment of code that produces a value. It is useless on its own, but can be used by enclosing code.
  2. a binding is a way that javascript stores values for later use, also known as a variable.
  3. environment - a collection of bindings and their values, providing ways for users to interact with the surrounding system.
  4. function - a piece of program wrapped in a value, which can be executed by inputting or providing parameters or arguments
  5. console.log(Math.max(2, 4));
  6. side effect is another type of useful effect that can be returned by a function such as prompting a dialog box or writing text to the screen
  7. console.log(math.min(2, 4) + 100) returns the value 102, window.prompt(“Gimme your money”) produces the side effect of creating a user prompt
  8. Control flow is the order and time by which a function executes, when can be straight and simple or complex and meandering
  9. conditional execution is the “if” statement, which functions similar to the way it does in C++ where in elements of the function only execute under certain conditions.
  10. “if”, sometimes “else”
1 Like

1.An expression is a fragment of code that produces a value.
2.Bindings or variables are things in JavaScript used to hold values.
3.An environment is a collection of bindings and their values that exist at any given time.
4.A function is a piece of program wrapped in a value.
5. prompt(“Learn JavaScript”)
6.Side effects are the product of functions.
7.console.log(5 * 12); // alert(“Good Morning”);
8.Control flow is how JavaScripts processes statements. They are executed from top to bottom.
9.If this then do that. Statements will be executed if other variables or statements are true.
10.Conditional expressions are if / else.

1 Like

1.fragment of code producing value
2.A binding or a variable is assignment of internal state used to catch and hold values
3.The collection of bindings and their values that exist at a given time is called
the environment.
4. reusable code that is used to perform a single, related action.
5.prompt(“Enter passcode”);
6.If a statement or function modifies the state of something else (outside its own scope), then it is
producing 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.
7.
side effect: prompt(“Enter your name”);
value : console.log(Math.max(2, 4));
8. control flow (or flow of control ) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.
9.where the program takes the proper branch based on the
situation at hand.
10.if

1 Like

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

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

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

What is a function?
In the source code, a function refers to a piece of Javascript that is stored in one place and can be called from other places as often as desired. Functions have parameters, which are a list of variable names, which are available like local variables during execution and whose values - called arguments - are provided by the caller.

Give an example of a function.

function celsiusInFahrenheit(celsius) {
return celsius * 1.8 + 32;
}

What is a side effect?
If a statement changes the world environment or changes the internal state of the machine and affects the statements that come after it, this is called a side effect.

Give an example of a function that produces a side effect and another function that produces a value.
let theNumber = Number(prompt(“Pick a number”));
if (!Number.isNaN(theNumber)) {
console.log("Your number is the square root of " +
theNumber * theNumber);
}

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?
It is code which will only be executed based on a result

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

1 Like

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

What is a binding?
Binding, or variable 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 passcode”);

What is a side effect?
Side effects happen when a statement changes the world environment or changes the internal state of the machine and affects the statements that come after it.

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

  1. side effect: console.log (a);
  2. value: let a = 1;​

What is control flow?
control flow ensures that statements are executed in the proper order

What is conditional execution?
this is where the program can execute different statements depending on the situation presented

What kind of keyword do you need to use to invoke conditional execution?
The If Then Statement would be an example of a conditional execution

1 Like
  1. An expression is fragment of code that has a value. Using an operator to bring two expressions together makes it a statement. This is a full sentence of code that creates a value.

  2. A binding does not contain values, it grasps them. A binding is “let” or a variable. (ie var a = 12) where a is the variable, binding itself to the value of 12.

  3. An environment is a collection of bindings and variables that exist at any given time. An environment isn’t empty, like entering a browser website, there are bindings and values that are already created in order to interact with the website.

  4. A function is a piece of program wrapped in a value. These values can be applied all at once by running a single function. A function is a pillar of Javascript programming.

  5. An example of a function is creating your own variables (ie janeApples = 17 and bobApples = 3) then, create the function name (ie countApples). the code would be : function countApples(janeApples, bobApples) {return janeApples + bobApples; } . By doing this, you can use the function countApples(17, 3); or plug in any other number into the paranthesis at any line when writing the code, since it is bound to the created function.

  6. A side effect is showing a dialogue box or writing text to the screen.

  7. An example of a side effect is console.log(prompt(“What is your name”));
    An example of a side effect that produces a value is console.log(Math.max(2, 4)); where it will return he greater number : 4.

  8. Control flow is how the computer reads the coding, namely like a “story mode.” When there is more than one statement involved in the code, it reads and executes from top to bottom.

  9. However, not all programs are straight line reading. There may be a situation where you want it to execute a code and then have an option to branch based off of a certain return. This is called conditional execution.

  10. keywords needed to invoke a conditional execution are “if, else and else if”

1 Like
  1. What is an expression?

A fragment of code that produces a value is called an expression. Every value is such or written literally(5 or “Freak”) is an expression.

  1. What is binding?

A value assigned to a keyword or phase to create a binding element that grasp values.

  1. What is environment?

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

  1. What is a function.

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

  1. Give an example of function?

Console.log is a example to output values as a piee to output values as a piece of program wrapped in a value.

  1. What is a side effect?

The showing a dialog 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 a value ?

Producing the side effect “Hello World” that will appear on the screen. Using math.max takes any amount of the number arguments and gives back the greatest.

  1. What is control flow ?

When your program is like a story and executed from top to bottom.

  1. What is conditional execution ?

The execution is based on the situation at hand where the program decides to branch.

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

“If”

1 Like
  1. What is an expression?
  • A fragment of code that produces a value is called an expression. var a = 28; 28 is an expression.
  1. What is a binding?
  • it is a value that we can set to a variable, after that you dont need to write the same code again and again.
  1. What is an environment?
  • it is a collection of bindings and values which exist in the same instance
  1. What is a function?
  • a function is a piece of program packed in a value
  1. Give an example of a function.
  • alert(“What? Alert is also a function?!”);
  1. What is a side effect?
  • side effect is an expression that change part of the code on the visible part meaning the web page.
    So literaly we change part of the code and it appears on the screen of the web page.
  1. Give an example of a function that produces a side effect and another function that produces a value.
  • var a =prompt("Put any number: ");
    var b =prompt("Put new number as b: ");
    console.log(a+b);
  1. What is control flow?
  • It is the direction of execution of code in from top to bottom
  1. What is conditional execution?
  • the program will decide the direction based on the certain conditions
  1. What kind of keyword do you need to use to invoke conditional execution?
  • if, else
1 Like
  1. A fragment of code that produces a value is called an expression.

  2. You should imagine bindings as tentacles, rather than boxes. They do not contain values; they grasp them. Two bindings can point to the same value.

  3. The collection of bindings and their values that exist 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 order to run the wrapped program.

  5. prompt(“full time cr
    ypto”);

  6. An expression or function that displays or changes the internal state of the string or value on the webpage, so the program can change statements that come after it is considered a side effect.

  7. console.log(Math.max(5, 8)); // → 8
    console.log(Math.min(5, 8) + 1000); // → 1005

  8. When your program contains more than one statement, the statements are executed as if they are a story, 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. This is called conditional execution.

  10. Conditional execution is created with the “if or else” keyword in JavaScript.

1 Like
  1. What is an expression?

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

  1. What is a binding?

A binding (also variable) is used to catch and hold values. The keyword „let“ (for example in: let caught = 5 * 5;) signifies that the sentence is going to define a binding. After a binding has been defined, its name (here: caught) can be used as an expression. In this example the binding grabs hold of the number that is produced by multiplying 5 by 5. The = operator can be used at any time on existing bindings to disconnect them from their current value and have them point to a new one. Bindings do not contain values, they grasp them (like tentacles).

  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. Values given to functions are called arguments.

  1. Give an example of a function.

The binding prompt holds a function that shows a little dialog box asking for user input. For example: 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.

An example of a function that produces a side effect is: console.log

An example of a function that produces a value is: Math.max

  1. What is control flow?

The control flow is the order in which the computer executes statements in a script. When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom. That means the code is run in order from the first line in the file to the last line. It is different if the computer runs across structures that change the control flow, such as conditionals and loops.

  1. What is conditional execution?

Not all programs are straight forward roads. Conditional execution means the program takes the proper branch in a branching road (created by us) based on the situation at hand.

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

Keyword to invoke conditional execution: If.

1 Like
  1. An expression is a value, you’re expressing the “code fragment”.
  2. A binding is is how a program remembers a value that you define
  3. The environment is all the values and bindings together.
  4. A function is a value that runs a program. This program is the function.
  5. Alert, cosole.log, and prompt are 3 functions we have used so far.
  6. Side effect is a result of a function that alters the state of an application
  7. math.min produces a value, prompt produces a side effect
  8. Control flow is the order of the program
  9. This is like an “if” “and” statement, letting you execute the program in deffering ways depending on the input
  10. You use if.
1 Like
  1. Anything that produces a Value is an expression in JavaScript. Any piece of code that resolves to a Value.

  2. A binding, or variable, is used to catch and hold value, The keyword “let” indicates the sentence is going to define a binding.

  3. An envirornment is a collection of bindings and their value that exist at a given time.

  4. A function is a piece of program wrapped in a value. Or a block of code designed to do a specific task.

5.alert(“alerts are a function”);

  1. A side effect is when a function returns a value that effects the “real world” like a pop-up on the screen or an internal change in how statements will be read from now on.

7 A function that produces a side effect : prompt(“hello there”); and a function that produces a value : console.log(Math.min(4, 99) + 100);
// --> 104

  1. Control flow is the order in which statements are executed. If you have more than one statement they are executed like reading a story, from top to bottom.

  2. Conditional Execution is when the program takes a proper branch for the situation at hand.

  3. the keywords “if” and “else” can be used to create 2 seperate, alternative exection paths.

1 Like

What is an expression?

  • An Expression is a fragment of code that. produces a value.

What is a binding?

  • Bind an objekt to a funktion and ref it using “this”

What is an environment?

  • collection of bindings and their values

What is a function?

  • piece of program wrapped in a value

Give an example of a function.

- prompt(“Enter passcode”);

What is a side effect?

- No crontrol

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

console.log = side effect and Math.max = a value.

1 Like
  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 is called
    the environment.

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

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

  6. A side effect is any application state change that is observable outside the called function other than its return value. Showing a dialog box or writing text to the screen is a side effect.

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

  8. Control flow is the order in which the program executes statements, which is from top to bottom.

  9. Conditional execution is when you want to create a branching road, where the program takes the proper branch based on the situation at hand.

  10. if

1 Like
  1. What is an expression?
    Expressions are any fragment of code that produce value.

  2. What is a binding?
    A binding is used to save values but can be changed again by a later binding.

  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.
    prompt(“Enter passcode”); - here the function leads to a small dialog box with the string “Enter passcode” shown.

  6. What is a side effect?
    A side effect is a change of state outside of the immediate context.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    function with side effect: alert(“Finish Project”);
    function that produces value: console.log(4 + 5);

  8. What is control flow?
    Control flow means that if you have more than one statement, all statements are executed after each other from top to bottom.

  9. What is conditional execution?
    Conditional executions means that 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 if” and “else”.

1 Like