Binding, Functions and Control Flow - Reading Assignment


#242
  1. What is an expression?
    It is any fragment of code that produces a value
  2. What is a binding?
    It is a any name or word that can hold value
  3. What is 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.
    Browser pop up dialog window prompting to enter a password
  6. What is a side effect?
    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.
    Concole.log(“hello Word”);
    Var Num2 = “ 4 + 6”;
  8. What is control flow?

#243
  1. A fragment of code that produces a value.
  2. A way for JavaScript to hold values.
  3. A collection of bindings and their values at that time.
  4. A way JavaScript processes arguments.
  5. function add2(n){
    return n + 2 };
  6. A side effect is any outcome of running the function other than returning a value.
  7. a) prompt(“username”);
    b) function numberdouble(number){
    return number*2 };
    8.The order in which the program executes code
  8. Using if else statements to decide the order the code will run in.
  9. If and else.

#244
  1. a line of code that spits out a value
  2. a tentacle of relationships between values / objects etc - the program needs to keep track where values are assigned … therefore it uses Bindings
  3. Environment is the space where code happens where some basic rules are already in place for guidance. ex: Default Bindings and Values are already set in a Browser console even when you start from scratch
    4)A function is a bracketed part of the code line that performs a certain tasks that can be referred or called upon it’s value whenever is needed later in the code
  4. alert(“learn more about JS”);
    or
    console.log (“now you see some text”);
  5. changing a value or a function that later in the code will impact the next values or functions in future computations is considered a side effect
    7)side effect example:
    prompt(“Enter your age”);
    value example:
    console.log(Math.max(2,4);
  6. Control flow is the execution of the code starting from top to bottom
  7. A branching in the control flow “if” this happens then do “this” for example
  8. if. if else

#245

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

What is a binding?
The thing that to catch and hold values

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.

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.

What is a side effect?
A function that will for example show a dialog box or written text to the screen.

Give an example of a function that produces a side effect and another function that produces a value.
prompt();

What is control flow?
When your program contains more than one statement, the statements are executed from top to bottom.

What is conditional execution?
where the program takes the proper peace of code based on the situation at hand

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


#246
  1. Any part of a code that produces a value.

  2. Mein ding, dein ding, binding…

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

  4. An expression wrapped in a value. It performs a specific task and can be called for use in other expressions.

  5. alert(“Mein ding, dein ding, binding.”)

  6. Any observable change in the state of the application outside the called function other than its return value.

  7. alert(“Mein ding, dein ding, binding.”)
    console.log(Math.max(2, 4))

  8. The order in which the computer executes statements in a script.

  9. When code is executed only if a condition is met.

  10. if, else if, else


#247
  1. An expression is a piece of code that outputs a value.
  2. A binding is a variable.
  3. An environment is the collection of bindings and their values at a given time.
  4. A function is a piece of a program wrapped in a value.
  5. prompt(“Type in your credit card number pretty please”);
  6. A side effect is an event that is observable outside of the called function besides its return value.
  7. prompt(), Math.max()
  8. Control flow is the order that code is run (top to bottom).
  9. A conditional execution happens if something else happens prior.
  10. “if” begins a conditional execution.

#248

What is an expression?

  • any part of the whole program code is called expression
    What is a binding?
  • a name tag connect to variables so as to easily called it out later
    What is an environment?
  • environment contain then variables and value when the program is running
    What is a function?
  • input parameters and give output
    Give an example of a function.
  • console.log()
    What is a side effect?
  • unexpected action by the function, like max function will including the return value action
    Give an example of a function that produces a side effect and another function that produces a value.
    What is control flow?
  • the step of the program to run the expession
    What is conditional execution?
  • the program will not run all the code. codes are run based on the condition.
    What kind of keyword do you need to use to invoke conditional execution?
  • if

#249
  1. An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value.

  2. Binding is a method that creates a new function from another function with one or more
    arguments bound to specific values, including the implicit this argument.

  3. An environment is the data structure that provides the storage space for variables.

  4. A function is a set of statements that performs a task or calculates a value.

  5. Example of a function:
    function myFunction(p1, p2) {
    return p1 * p2; // The function returns the product of p1 and p2
    }

  6. A side effect is any application state change that is observable outside the called function other than its return value.

  7. Example of a function that produces a side effect:
    var tax = 20;
    function calculateTax(productPrice) {
    return (productPrice * (tax/100)) + productPrice;
    }

    Example of a function that produces a value:
    function priceAfterTax(productPrice) {
    return (productPrice * 0.20) + productPrice;
    }

  8. Control flow is the order in which the computer executes statements in a script.

  9. Conditional execution is performing different actions based on different conditions.
    10.If is the keyword to invoke conditional executions.


#250

What is an expression?
Data that is used in code that has a value.
What is a binding?
Creating statements within your code that allows you to catch and hold any value; aka variable.
What is an environment?
The bindings and values in a program at any given time.
What is a function?
A part of the program that has a value.
Give an example of a function: prompt(“On a scale of 10 to 10. How great is this course?”);
What is a side effect?
A statement that changes the following lines of code in the program.
Give an example of a function that produces a side effect and another function that produces a value.
side affect: const a = blackbalancesheet;
produces value: Math.max(2,4);
What is control flow?
The natural order of a program left to right and top to bottom.
What is conditional execution?
When the code as more than one course of action depending on the value chosen
What kind of keyword do you need to use to invoke conditional execution?
if


#251
  1. What is an expression?
    Fragment (or sentence) of code that produce a value.
  2. What is a binding?
    A value set it on a variable (Example:variable = something;)
  3. What is an environment?
    A collection of bindings and their values existing in an instance.
  4. What is a function?
    Is a collection of coded instructions that can be used (invoke or call) to run those instructions on a selected value(s) and return a solution.
  5. Give an example of a function.

function LikeButtonPounded(button){
if (button = true) alert(“Thanks for the Like!”);
else alert(“POUND THAT LIKE BUTTON GUYS!”);
}

  1. What is a side effect?
    Its the returned value from a function.
  2. Give an example of a function that produces a side effect and another function that produces a value.

alert(“Hello im alert function, i produce a side effect!”);
var NoSideEffect = true;

  1. What is control flow?
    Can be described has the order of how coded instructions should be executed.
  2. What is conditional execution?
    IF variable fulfill some conditions, then do this or that (or not).

Example:
var number = 1;
If (number==1) alert(“Yes, variable has set number ‘1’.”);

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

#252

1 What is an expression?
A; A Fragment of code that produces a value is called an expression. Expressions can contain expressions.

2 What is a binding?
A: Bindings (also known as variables) in JavaScript are used to capture and hold values. Should be thought of as tentacles and not boxes. Binding do not contain values; they grasp them. Binding names can be any word, but cannot start with a letter.Note exceptions of binding words.on p25

3 What is an environment?
The collection of bindings and values that exist at any point in time is called an environment.

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

5 Give an example of a function.
A: When one is prompted to enter a password

6 What is a side effect?
A: 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.

8 What is control flow? When a 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?
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?
‘If’


#253
  1. What is an expression?
    A fragment of code resulting a value.

  2. What is a binding?
    A way to assign a value.

  3. What is an environment?
    The collection of bindings and their values at the point in time.

  4. What is a function?
    A selection of code that is called to execute and return a value.

  5. Give an example of a function.
    prompt(“Enter your name”);
    // This will ask the user to input their name in a prompt box.

  6. What is a side effect?
    Change to the internal state of the machine in a way affecting all statements that come after it.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“Enter Full Name:”);

  8. What is control flow?
    The order which the code is executed in the script.

  9. What is conditional execution?
    the code is to be executed when certain conditions are met, if they match the rules stated by the program.

  10. What kind of keyword do you need to use to invoke conditional execution?
    ‘If’ ‘else if’ and ‘do while’ statements.


#254

1.anything that froduces a value and has a semicolon at the end of it.
2. a binding is when a tag is created which references some other tag or value
3. The collection of bindings and their values that exist at a given time.
4. a function is code which produces an action,
5. console.log
6. side effects produce text on screen or dialogue boxes,
7. alert function creates a dialogue box side effect. Functions that produce values are ones such as Math.max
8. control flow is straight line or conditional, such as when if statements are used to determine a path for the program to run.
9. it is code that executes when some condition is true. Uses the if keyword.
10. if, else, while, do


#255
  1. What is an expression?
    A fragment of code that produces a value which produces a change immediately or sometime after it

  2. What is a binding?
    A variable; when you say that variable = a value

  3. What is an environment?
    The set of bindings in a program that are called upon based on actions within the codes environment

  4. What is a function?
    It is a specific action either already existent in the programming language or an action that you customized yourself. Functions take values in the form of function arguments, and depending on what function being used will require certain amounts or characters/numbers to work as intended

  5. Give an example of a function.
    Console.log() alert() prompt() and lots more we haven’t seen

  6. What is a side effect?
    When an action performed in a program say by a function produces a result that isn’t immediately given and thrown out

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Math.max() just gives a value
    Number() takes a value that is given to it in order for it to be called upon at a later point in the program

  8. What is control flow?
    When you bind a value and actually use it later in a straightforward way that doesn’t require any checks or conditions for it to run

  9. What is conditional execution?
    Like with Control flow but this requires a condition to be met such as a Boolean

  10. What kind of keyword do you need to use to invoke conditional execution?
    Else / If ……If (condition is met) then perform X
    Else(condition wasn’t met) perform Y


#256
  1. A Fragment of code that produces a value.
  2. Aka variable, is used to catch and hide values long term; grasp them not hold them.
  3. The collection of bindings and their values.
  4. A piece of program wrapped in a value.
  5. prompt(“User ID”)
  6. Any application state change that is observable outside the function
  7. see 5
    console.log(Math.max(2,4));
    // is 4
  8. Multiple expressions read from top to bottom in a straight line.
  9. When the program takes a branch from it’s straight line to execute the proper value.
    10.“if”

#257
  1. A fragment of code that produces a value
  2. A place to catch and hold values
  3. A collection of bindings and their value at any given time
  4. A piece of program wrapped in a value
  5. Alert()
  6. Something a function does that is not it’s primary objective. ie dialog box to present something
  7. Prompt() produces a side effect ( dialog box). Math.max() does not.
  8. It describe the sequence in which program statements are executed
  9. Describe parts of a program where different statements will be executed based on a condition.
  10. If statement

#258

1 What is an expression ?

An expression is any valid unit of code that resolves to a value. Conceptually, there are two types of expressions: The expression x = 7 is an example of the first type in which the ‘=’ operator to assign the value seven to the variable x. The expression itself evaluates to seven. The code 3 + 4 is an example of the second expression type. This expression uses the ‘+’ operator to add three and four together without assigning the result, seven, to a variable.

2 What is a binding ?

To catch and hold values, JS provides a thing called a binding or variable. The keyword ‘var’ or ‘let’ or ‘const’ are used to define a binding. It is followed by the name of the binding and give it a value by an ‘=’ operator.

for example : var x = 10;

This binding value can be change at any time as

var x = 10;
console.log (x); // it will print 10
var x=9;
console.log(x); //it will now print 9

3 What is an environment ?

The collection of bindings and their values that exist at a given time is called the environment. When a program starts, 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 system. For example : in a browser, there are functions to interact with the currently loaded website and to read mouse and keyboard input.

4 What is a function ?

A function is a block of code designed to perform a particular task (a set of statements that performs a task or calculates a value). For example, in a browser environment, the binding ‘prompt’ holds a function that shows a little dialog box asking for user input.

5 Give an example of a function.

A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). A function is executed when “something” calls it.
ex : function name(parameter1, parameter2, parameter3 ) { //the values given in function are called ‘Arguments’.
code to be executed
}

6 What is a side effect ?

A side effect is any interaction with the outside world from within a function. That could be anything from changing a variable that exists outside the function, to calling another method from within a function.

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

function priceAfterTax(productPrice) {
return (productPrice * 0.20) + productPrice;
} // It doesn’t depend on any external input and it doesn’t have any side effects. If you run this function with the same input 100,000,000 times it will always produce the same result.

var tax = 20;
function calculateTax(productPrice) {
return (productPrice * (tax/100)) + productPrice;
}// It produces side effect because it depends on an external tax variable! A pure function can not depend on outside variables,thus this function is impure.

8 What is control flow?

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

9 What is conditional execution?

If a given condition is true, we execute one block of code…if it is false, we execute another block of code. This type of sxecution is called conditional execution.

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

Conditional execution is created with the ‘if’ and ‘else’ keywords. If the condition given with ‘if’ keyword is true then the ‘if’ block is executed and if the condition given with ‘if’ keyword is false then the ‘else’ or any other block after ‘if’ block is executed.


#259

1. What is an expression? It is a fragment of code that produces a value and corresponds to a part of a JavaScript statement. A list of statements can be a program. In turn, a list of statements can be a program.
2. What is a binding? It is a certain type of statement where you define a bind of a name with a value.
3. What is an environment? It is a collection of bindings and their values that exist when a program starts up.
4. What is a function? It is a piece of program wrapped in a value.
5. Give an example of a function.
6. What is a side effect? It is a change of the internal state of the machine, implemented by a statement, that will affect 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.
This function produces a side effect showing a dialog box:
prompt("Enter your username or email")
This function produces a value evaluating if an expression or variable is true:
Boolean(1); // returns true
8. What is control flow? It is when a program executes their different statements from top to bottom.
9. What is conditional execution? It is when a program creates a branching road and takes the proper branch based on the situation at hand.
10. What kind of keyword do you need to use to invoke conditional execution? You need the if keyword that executes a statement depending on the value of a Boolean expression.


#260
  • What is an expression?
    A fragment of code that produces a value is called an expression. Expressions can be as long as you want them to be, but they would always result in a single value.Even a single digit / number is called as expression.

  • What is a binding?
    Bindingd and Variables are used to remember the assigned term values throuought the programme to maintain its internal state. Those can be changed at any instant of time.

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

  • What is a function?
    It is block of reusable code that allows us to write code once and reuse it as many times as we want by just recalling the function. Executing a function is called invoking, calling, or applying it.

  • Give an example of a function.
    function addNumbers(firstNumber, secondNumber)
    {
    var result = firstNumber + secondNumber;
    return result;
    }

  • What is a side effect?
    A side effect is any application state change that is observable outside the called function other than its return value. Side effects include: Modifying any external variable

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

  • What is control flow?
    If programme contains more than one statement, then they need to be executed as if they are a story, from top to bottom this is called as control flow of programme

  • What is conditional execution?
    It allows certain part of code to be executed if only if conditions are met

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


#261
  • What is an expression?
    A Fragment of code that produces a value
  • What is a binding?
    An action that is used to catch and hold values
  • 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
  • Give an example of a function.
    Prompt(“enter passcode”);
  • What is a side effect?
    When a change in the internal state of the machine affects other statements that come after it
  • Give an example of a function that produces a side effect and another function that produces a value.
    Prompt(“enter passcode”) side effect function
    Math.max(2,4) value function
  • What is control flow?
    When you program has more than one statement the statements are executed as if they are a story
  • What is conditional execution?
    When you create a branching road and 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?
    It is created with the “if” keyword