Binding, Functions and Control Flow - Reading Assignment

  1. What is an expression?
    An expression is any fragment of code that results in a value.
  2. What is a binding?
    A binding occurs when a value is assigned to a variable
  3. What is an environment?
    An environment is a collection of bindings and their values
  4. What is a function?
    A function is a piece of program wrapped in a value.
  5. Give an example of a function.
    function test(num1, num2)
    {
    return num1 >= num2;
    }
  6. What is a side effect?
    A side effect occurs when the program displays a dialogue box or writes text to the screen.
  7. Give an example of a function that produces a side effect and another function that produces a value.

function helloworld() {
alert(“Hello World!”)
}
function pie() {
return math.pi
}
8. What is control flow?
Control Flow describes the path taken by the program.
The most simple type is a straight line, but inclusion of {if|else|while|for|break etc} statements cause the flow to be more complicated.
9. What is conditional execution?
The next part of the code is executed if the condition is met, or else do something else.
10. What kind of keyword do you need to use to invoke conditional execution?
if | else

1 Like
  • What is an expression?
    A fragment of code that produces a value is called an expression. every value that is written literally is called an expression.

  • What is a binding?
    Binding is the way a program captures and keeps an internal state with a value that we can use later. 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.

  • 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?
    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.
    alert(“Hello world!”)

  • What is a side effect?
    A “side effect” is an “expression”(code) that affects the program.

  • Give an example of a function that produces a side effect and another function that produces a value.
    alert(“alert is a function that produces a side effect”)
    console.log(5*5); produces a value.

  • What is control flow?
    It is the order in which your statements are executed in. “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?
    Its is the point at which the programs decides what to do based on certain conditions. Conditional execution is created with the “if” function in java script. When we want our code to execute “if” and only “if” certain conditions are met we use the “if” Keyword.

  • 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.
  2. A thing to catch and hold values. Also called 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. Give an example of a function.
  6. Showing a dialog box or writing text to the screen.
  7. console.log(“side effect”); Math.max(“value1”,“value2”);
  8. The statements are
    executed as if they are a story, from top to bottom.
  9. Going on different branches of execution(making skips in the story) based on any conditions.
  10. if
1 Like

Q). What is an expression?
A). A regular expression is a sequence of characters that forms a search pattern.When you search for data in a text, you can use this search pattern to describe what you are searching for.
A regular expression can be a single character, or a more complicated pattern. Regular expressions can be used to perform all types of text search and text replace operations.
Q). What is a binding?
A). The “bind” method in Javascript is used to bind some of the arguments of the function including the “this” reference. In other words, bind method allows us to define what objects to bind to when executing method, what will be the execution context for the methods, and what will be the preset value of the function when invoked.
Q).What is an environment?
A). JavaScript typically relies on a run-time environment (e.g., a Web browser) to provide objects and methods by which scripts can interact with the environment (e.g., a webpage DOM ). It also relies on the run-time environment to provide the ability to include/import scripts (e.g., HTML elements).
Q).What is a function?
A). A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses ().

Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).

The parentheses may include parameter names separated by commas:
(parameter1, parameter2, 
)
Q).Give an example of a function.
A).Convert Fahrenheit to Celsius: // (https://www.w3schools.com/js/js_functions.asp)

function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
document.getElementById(“demo”).innerHTML = toCelsius(77);

Q).What is a side effect?

A). Side effects include, but are not limited to: Making a HTTP request. Mutating data. Printing to a screen or console. DOM Query/Manipulation. Math.random() Getting the current time.
Q).Give an example of a function that produces a side effect and another function that produces a value.
A). // doesn’t always return the same value
function counter() {
// globals are bad
return ++x;
}
// omitting calls to say change logging behavior
function say(x) {
console.log(x);
return x;
}

Q). What is control flow?

A). Control flow testing is a testing technique that comes under white box testing. The aim of this technique is to determine the execution order of statements or instructions of the program through a control structure. The control structure of a program is used to develop a test case for the program.
Q). What is conditional execution?
A). Binary Selection ¶ In order to write useful programs, we almost always need the ability to check conditions and change the behavior of the program accordingly. Selection statements, sometimes also referred to as conditional statements, give us this ability. The simplest form of selection is the if statement .
Q).What kind of keyword do you need to use to invoke conditional execution?
A). IF/ELSE, THEN

1 Like
  1. An expression is one or more lines of code, ending in a semicolon.
  2. A binding is a kind of expression called a statement, and it is a tag that binds to a value stored in memory
  3. An environment is all of the bindings in the code.
  4. A function is a value that contains a piece of program. Functions do something and return some value or side effect.
  5. function jingleBells() { console.log(“ring”); }
  6. A side effect is the change to the world required for an expression to be deemed a statement. This can be a change to the internal state of a machine or in producing some text or other effect in the outside world.
  7. function sideEffect() { console.log(“i am a side effect”); }
    function noSideEffect(a, b) { return a + b; }
  8. Control flow is the way the program is read by the machine, which is set to read the program from top to bottom.
  9. Conditional execution breaks the default linear control flow and executes lines of code depending upon conditional statements that must be satisfied.
  10. if
1 Like
  1. What is an expression?
    Ans: An expression is a piece of code that produces a value.

  2. What is a binding?
    Ans: A binding is simply another name for a variable. It catches and holds a value.

  3. What is an environment?
    Ans: The environment is defined as the collection of all the bindings and it’s corresponding values at any given point in time.

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

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

  6. What is a side effect?
    Ans: A side effect occurs when a given statement (when executed) changes the internal state of the system such that one or more statements after that statement are affected/changed.

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

     A.  c = 2
          function sideeffect(a , b) {
             sum = a + b;
          }
             c = sum               
    
      B.  function value(a , b ) {
             sum = a + b;
             return sum;
          }
    
  8. What is control flow?
    Ans: Control flow is the way/direction in which the statements of a program are executed. In Javascript, typically, statements are executed in order from top to bottom.

  9. What is conditional execution?
    Ans: Conditional execution is when the statements of a program are not ALL executed in top-bottom fashion. Sometimes, certain statements are skipped if they don’t meet the condition provided for it’s execution and instead other statements are executed.

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

1 Like
  1. Expression is a fragment of code which produces a value.
  2. A binding is a value that is store in computers memory.
  3. An environment is set of variables and their values that exist in memory at a given time.
  4. A function is a piece of code which performs a specific task.
  5. prompt(“Enter your name”);
  6. Showing a dialog box or writing text to the screen is a side effect.
  7. let num = 0;
    const func = () => {
    num = 1;
    return true;
    }
    func();
  8. Control flow is the order in which we code and have our statements evaluated.
  9. Conditional Execution is a branch in the control flow’s execution, where JavaScript picks a branch depending if the conditions that are present.
    10.if
1 Like
  1. What is an expression? A fragment of code that produces a value, every value that is written literally, could be a “word” or a number.
  2. What is a binding? A binding is the name of the memory given to represent it. The answer to that memory can then be used as en expression.again and again until it is changed.
  3. What is an environment? It’s the collection of bindings and their values that exist on a programme.
  4. What is a function? A piece of programme wrapped in a value
  5. Give an example of a function - eval(). Evaluates a string and executes it as if it was script code
  6. What is a side effect? The outcome of the code written, if you wanted to change screen background colour you would write the code to request that and the screen changing colour is the side effect.
  7. Give an example of a function that produces a side effect and another function that produces a value- value- isFinite() Determines whether a value is a finite, legal number. Side effect - String() Converts an object’s value to a string
  8. What is control flow?it is the way the programme reads the statements from top to bottom when there are more than one statement.
  9. What is conditional execution? Its when a programme will branch off depending on the situation at hand
  10. What kind of keyword do you need to use to invoke conditional execution? if
1 Like
  1. A line of code that updates or adds a new value
  2. Binding is the same word for variable
  3. Collection of variables
  4. A block of code that executes a specific task
function MathAddition(var num1, var num2)
{
     return num1 + num2;
}
  1. The action of a statement (displaying text on the console etc)
    7
function Display(var text)
{
     console.log(text);
}

function MathAddition(var num1, var num2)
{
     return num1 + num2;
}
  1. List of sequential code that contributes to one outcome
  2. Block of code that gets executed only if the specified condition return true
  3. if
1 Like
  1. An expression is a fragment of code that produces a value.
  2. A binding or variable, is a thing Javascripts provides 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 would be: prompt (“enter passcode”)
  6. A side effect is a change if the internal state of the machine that will affect the statements that come after it.
  7. An example of a function that produces a side effect: prompt
    An example of a function that produces a value: console.log(Math.max( ))
  8. Control flow is the order in which two or more statements are executed.
  9. Conditional execution is created to check that a condition is met in order to be able to execute.
  10. Conditional execution is invoked with the keyword: if
1 Like
  1. Expressions are anything that produce values.

  2. Bindings are used to store values for later use.

  3. The environment is anything that can be pulled from or used with JavaScript.

  4. Functions are used to call values or expressions from memory and compute them.

  5. prompt(“Enter your mom’s phone number”);

  6. A side effect is additional code or interface that is sometimes produced from invoking or calling a function.

  7. A side effect would be the dialog box that appears when calling the function mentioned above to input your mom’s phone number. A value would result from using: function(“a + b”);

  8. Control flow is reading the program from top to bottom.

  9. Conditional execution utilizes the “if” keyword and gives the program separate paths to follow depending on how the program is used (“if” this happens then do this).

  10. Use “if” to utilize conditional execution.

1 Like

What is an expression?
—it is a fragment of code that creates a value
What is a binding?
—is also known as a variable which catches and holds values, otherwise producing values would disappear if it’s not used immediately
What is an environment?
—it is a collection of bindings and its values that exist at a particular time
What is a function?
—a piece of program wrapped in value
Give an example of a function.
— promt(“Enter password”)
What is a side effect?
—happens when writing text to the screen or showing a dialog box
Give an example of a function that produces a side effect and another function that produces a value.
— Perhaps adding a comment to the screen is a function that produces a side effect—Console.log(Math.max(6, 12); produces the value of 12
What is control flow?
—when there is more than one statement the program executes it from top to bottom
What is conditional execution?
—when the program takes the proper branch based on a particular condition at the moment
What kind of keyword do you need to use to invoke conditional execution?
—with the keyword if

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

  2. Binding (bind) allows an object to borrow a method from another object without making a copy of that method.

  3. Enviornment is variables and values that exist at any given time.

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

  5. alert (" I think I am getting this");

  6. A side effect is when you change the state of the program through an indirect means.

  7. print(“Welcome Home”)

var bellaslove = 400;
mommyslove = bellaslove * 400;
mommyslove;
1600

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

  2. Conditional execution is used when you want a certain code to be executed when a certain condition hold or when the condition does not hold.

  3. Conditional expression , IF

1 Like

1.) An expression is a fragment of code that produces a value. Expressions may contain other expressions with in them.
2.) Bindings are sort like tentacles that grasp values and retain them in the context of their program and its need to reference stored values. Bindings can be attached to multiple values simultaneously and be used a expressions once their value is defined.
3.)The environment is the sum of all the bindings and their values that exist at any given time.
4.) A function is a part of a program wrapped in values.
5.) An example of a function would be console.log which although isn’t a binding is an expression that retrieves the log property from the value held by the console binding.
6.) A side effect is a dialog box or writing text to the screen. Side effects are produced by functions.
7.) An example of a function that produces a side effect Prompt (“enterpasscode”); which will produce a dialog box. An example of a function that produces a value is console.log(Math.max(2, 4)); which returns the value // → 4.
8.) Control Flow is the process at which a program is executed when that program contains more than one statement. The statements are always executed from top to body like in a story.
9.) A conditional execution is and “if” statement in Javascript and creates a sort of like branching effect in the program where the code will be executed only if a certain condition is met with in that code.
10.) The “if” keyword invokes a conditional execution.

1 Like
  1. What is an expression?
    It’s a fragment of code which produces a value.

  2. What is a binding?
    It’s a value set to a variable, which we won’t need to write again the same expression

  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.
    console.log(10 * 10);

  6. What is a side effect?
    Side effect is something that happens from a function, like a dialog box

  7. Give an example of a function that produces a side effect and another function that produces a value.
    side effect: prompt(“Enter passcode”);
    console.log(10 * 10);

  8. What is control flow?
    It’s the order in which program will execute the code.

  9. What is conditional execution?
    Conditional execution happens when program has more than one possible functions to execute, and will execute one depending on situation.

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

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

  2. What is a binding?
    Binding sets a value for memory for a given code.

  3. What is an environment?
    A group of bindings but together and the solution to the results from those grouped bindings is called the environment.

  4. What is a function?
    A function is a piece of code in with a user inputs a value and the function returns another value.

  5. Give an example of a function.
    The password to enter a website, credit card payment form.

  6. What is a side effect?
    A side effect is the change caused by running the function, to the world, or the machine.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    A function that produces a side effect is entering a password allowing the user access to password required information, a function that produces a value is inputting your age and weight, and the program gives you your BMI.

  8. What is control flow?
    Is a step by step process to move through a program.

  9. What is conditional execution?
    This is an if/then process of moving through a program.

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

2 Likes
  1. What is an expression?
    It is a value which is written literally ie., (24) or (“your name”)

  2. What is a binding?
    It is a variable to catch and hold values. It is a kind of statement using a keyword such as -let- ie. let ten = 10

  3. What is an environment?
    It is the collection of bindings and their values which exist at a given time.

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

  5. Give an example of a function.
    ie. -prompt- in a browser environment. The prompt function causes a dialogue box to appear.

  6. What is a side effect?
    It is a return value which means that it shows up on the screen.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    for example if I use the code prompt (“enter password”) a dialogue box will pop up with the words “enter password” in it.

  8. What is control flow?
    In a program with more than one statement it is the order of execution of those expressions. That order moves from top to bottom.

  9. What is conditional execution?
    In a conditional execution a statement, or command is only carried out if the conditions are met.

  10. What kind of keyword do you need to use to invoke conditional execution?
    The most common is the keyword - if
    There are others such as - else if.

1 Like
  1. Expression is fragment of code that produces value.

  2. Bindings or variables are held values meant to be used later in code.

  3. A given parameter of values and bindings at a given point.

  4. A program wrapped in a value.

  5. prompt (“What is the name of your favorite pet”)

  6. A function which produces a result and returns that value.

let num = Number(prompt(’‘What’s your power level?’’));

if (num < 9000) {
console.log("Weak Sauce’’);
} else if (num>9000) {
console.log(“THAT’S IMPOSSIBLE!!!”)
}

  1. An execution of code that results from top to bottom.

  2. An execution of commands reliant upon the environment the are in.

10.if else when true false.

1 Like
  1. Any fragment of code that produces a value is considered an expression.

  2. A binding is a memory of a value.

3.An environment is the collection of bindings that exist at any given time.

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

  1. An example of a function would be as follows: prompt(“Enter Ethereum Address”);

  2. A side effect is a function that causes something to appear on the website.

7.An example of a function that produces a side effect would be prompt(“Enter Ethereum Address”); and an example of a function that produces a value would be console.log(Math.min(10, 6) + 464); // → 470

8.Control Flow is when a program contains more than one statement and they are executed in order from top to bottom.

  1. Conditional execution is when a action is only taken if certain conditions are present.

  2. To invoke conditional execution, the “if” keyword must be used.

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

  2. Binding is when the computer captures and holds values that will be used later in the program.

  3. An environment is the collection of bindings and their values that exist at a given time. The environment is not empty. It contains bindings standard to the language.

  4. A function is a operation that can be executed by the computer. It allows you to write a block of code, give it a name and then execute it as many times as needed.

  5. prompt();

  6. A side effect is something that happens after a function is run. Examples include showing a dialog box or writing text to the screen. Functions may also produce values and no side effects.

  7. Function that produces a side effect: prompt();
    Function that produces a value: Math.max();

  8. The order in which programs are read and executed, from left to right, top to bottom.

  9. A conditional execution is when a program takes the proper branch based on the situation on hand. Conditional execution is created with the if keyword in JavaScript.

  10. Conditional execution is created with the if, else if, and else keyword in JavaScript.

1 Like