Binding, Functions and Control Flow - Reading Assignment

[quote=“ivan, post:1, topic:3069”]

  1. What is an expression? Expressions are numbers, symbols and operators grouped together that show the value of something.

  2. What is a binding? The Bind (…) method allows us to easily set which object will be bound by a keyword when a function or method is invoked. ex.) var a=9

  3. What is an environment? I view this as sort of the like the rules that the programer establishes so that javascript knows what do do.

  4. What is a function? A function in JavaScript is similar to a procedure in that it’s a set of statements that perform a task or calculate a value, but for a procedure to qualify as a “function” , it should take some input and return an output

  5. Give an example of a function. Return number * number;

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

  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 Control flow is the order in which the computer executes statements in a script.

  9. What is conditional execution? I believe you are referring to bolean. These are true or false statement.

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

1 Like

1. What is an expression?
A fragment of code that produces a value is called an expression. every value written literally is an expression.
2. What is a binding?
to catch and hold values is what binding does
3. What is an environment?
it is a collection of bindings and their values that exist.
4. What is a function?
a function is a piece of program wrapped in a value
5. Give an example of a function.
alert(“this is my program”);
6. What is a side effect?
it is an when there is a state of change outside of the called function
7. Give an example of a function that produces a side effect and another function that produces a value.

function plusWithSideEffects(x, y) { alert("This is a side effect"); return x + y; } 
**8. What is control flow?**
It is the direction of execution of code in JavaScript which happens in a top down approach.

**9.** ***What is conditional execution?***
* Conditional execution is used when a website has input from a user, it allows the program to behave differently based on different information being entered or manipulated by the user.

**10. 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
  2. What is a binding?
    a way of attaching a value to a variable
  3. What is an environment?
    collection of the bindings and values at a given time in the course of running a program
  4. What is a function?
    piece of a program wrapped in a value
  5. Give an example of a function.
    AddThese(number1,number2) {
    return number1 + number2
    }
  6. What is a side effect?
    changes to state of the environment after a statement occurs
  7. Give an example of a function that produces a side effect and another function that produces a value.
    w/ side effect: prompt(“password please”)
    produces value: AddThese(number1,number2) {
    return number1 + number2
    }
  8. What is control flow?
    this is the direction a machine runs the code - left-to-right, top-to-bottom
  9. What is conditional execution?
    one which is awaiting information from a person
  10. 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 is a expression
  2. A binding permits to catch and hold a value
  3. An environment is a collection of binding and values
  4. A function is a piece of program wrapped in a vlaue
  5. prompt ( “enter passcode”)
  6. A side effect is the consequence of a function such as writing text to a screen
  7. console.log (Math.max( 2,4)) ; produces 4 is a value function
  8. Control flow is the order that the program reads various statements
  9. A conditional execution if , and only if, a certain condition is met
  10. If
1 Like
  1. An expression in JS means any kind of codes 1 line or many lines which produces a value is called an expression

  2. A binding can be described as an alias or some kind of placeholder for a value like f.e. a variable

  3. An Environment is the collection of all bindings and their values at a specific amount of time

  4. A function is an expression which looks like this: function() and is basically a piece of program wrapped in a value

  5. The classic console.log() Function

  6. A side effect is the all the expressions of the function which ihas nothing to do with its value

  7. hellofunction(args1) {
    //side-effect = console.log(“Hello, World”)
    console.log(“Hello, World”);
    }
    returnfunction (args1) {
    return args1*args1;
    }

  8. The Control Flow is the sequence in which a program is executed, usually it is from top to bottom an from left to right

9.A conditional execution is where a program reads a boolean statement and then choose therefore which part to take

  1. Usually it is if and else keywords
1 Like
  1. Anything that holds a value is called an expression.
  2. A binding is a function to catch and hold a value.
  3. In a program, collection of bindings and their values that present at a given time is called an environment.
  4. A function is a piece of program wrapped in a value.
  5. console.log ();
  6. showing a dialogue box or writing text to browser screen by a function is called side effect.
  7. alert(argument) is produces a side effect , while console.log ( argument) produces a value.
  8. Some programs , having more than one statements, executes its statements from top to bottom. it is called control flow.
  9. Some programs , having more than one statements, select one of two statements for execution based on the condition set in previous statement. This is called conditional execution.
  10. if, if-else, while, for etc.
1 Like
  1. What is an expression?
  • An expression is every value that is written whether a number or string or operators as a fragment of code
  1. What is a binding?
  • It is such a thing provided in Javascript that can be used to catch and hold value such that the value binded can be used as an expression
  1. What is an environment?
  • It is the collection of all the bindings and their corresponding values at any given time
  1. What is a function?
  • a piece of program that’s wrapped in a value that can be used to run said program
  1. Give an example of a function.
  • console.log();
  1. What is a side effect?
  • side effect is a change that amounts to changing the world or affecting the world whether is displays something on the screen or causes the a change in the internal state of the machine
  1. Give an example of a function that produces a side effect and another function that produces a value.
  • console.log (“Hello World”) ;
  • console.log (1+1) ;
  1. What is control flow?
  • it is the top to bottom direction that executes when the program has more than 1 statements
  1. What is conditional execution?
  • it is the proper path taken when there are branches in the program based on the conditions at the time
  1. What kind of keyword do you need to use to invoke conditional execution?
  • “if” invokes conditional execution
1 Like
  1. What is an expression?
    A fragment of code that produces a value.

  2. What is a binding?
    Used to catch and hold values in memory.

  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. Such values can be applied in order to run the wrapped program.

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

  6. What is a side effect?
    The result of a statement the 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.
    Function that produces a side effect: prompt(“Enter passcode”);
    Function that produces a value: console.log(Math.max(2, 4));

  8. What is control flow?

  9. What is conditional execution?
    A function with the if keyword used to determine what result to execute based on certain conditions.

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

1 Like
  1. expression is a fragment of a code that produces a value - if you compare it with linguistic an expression is a part of a sentence
  2. a binding is a variable - that means you give the binding (variable) a specific name and bind it with a value e.g. var a = 5 --> this means that the variable/binding named a is equal to 5
  3. a collection of bindings and their values at a specific time is called environment.
  4. a function is section of a program that performs a specific task
  5. alert(“Hello World”)
  6. a function can produce value and side effects. side effects can be showing a dialog box or writing text to the screen.
  7. side effect: alert(“hello world”)
    value: console.log(10+2); // -> 12
  8. control flow: when there are more than one statements, the program will execute the statements from top to bottom - so like “first (row) come - first (row) served”
  9. conditional execution: when we need to split our program “road” e.g. we need to built in an “if this condition is met then this happens” into our code.
  10. to invoke we need if
1 Like
  1. What is an expression?
    An expression is a fragment of code that produces a value. Every value that is written is an expression.
  2. ***What is a binding?***A binding is what JavaScript uses to catch and hold values through keywords like “let” to define value and store it.
  3. What is an environment?
    The collection of bindings and their values that exist in the program are the environment.
  4. What is a function? Anything that produces a value is a function.
  5. Give an example of a function. One useful function is “console.log” which outputs values previously defined or even those that are undefined and serves benchmark to check progress of the programs code/ values / results.
  6. 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 for example logging to the console or writing to the screen.
  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 would be writing to the screen , while a function that produces a value would be math.max taking any amount of number arguments and gives back (returns) the greatest.
  8. What is control flow?
    Control flow describes how the code is executed from top to bottom as if they were a story .
  9. ***What is conditional execution?***Conditional execution is a figurative fork in the road. A branch in the road dependent on the conditions at hand.
  10. What kind of keyword do you need to use to invoke conditional execution?
    In JavaScript we use the keyword “if” to invoke a conditional execution.
1 Like

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

  1. What is a binding?
    Something to catch and hold values

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

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

  4. Give an example of a function.
    In a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input. It is used like this:
    prompt(“Enter passcode”);

  5. What is a side effect?
    Showing a dialog box or writing text to the screen

  6. Give an example of a function that produces a side effect and another function that produces a value.
    example of function that produces side effect : prompt(“Enter passcode”);
    example of function that produces value : Math.max(2, 4)

  7. What is control flow?
    The sequence of how the programs are executed, from top to bottom

  8. What is conditional execution?
    In creating a branching road in a program, it takes the proper branch based on situation at hand.

1 Like
  1. Expressions are pieces of code that return a value.
  2. Bindings are place holders for values.
  3. The environment is the collection of all of the existing bindings at a given time.
  4. Functions are pieces of program that are wrapped in value.
  5. alert("Learn to Code!”);
  6. Side effects change the internal state of a machine by changing the behavior of a program.
  7. prompt(“Username”);
  8. Control flow is how the code is executed. It is read from top to bottom.
  9. Conditional execution is the how a program decides to read code based on certain conditions.
  10. You can use “if” and “else”
1 Like

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

*** What is a binding?**
Binding (or variable) is an expressin that catches and hold a value. Binding are like tentacles - they do not contain values, they grasp them - two binding can refer to the same value.

*** What is an environment?**
An environment ist hte collection of bindings and their values that exist at a given time.

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

*** Give an example of a function.**
console.log();

*** What is a side effect?**
Showing a dialog box or writting text to the screen.

*** Give an example of a function that produces a side effect and another function that produces a value.**
Side effect: console.log();
Value: Math.min();

*** What is control flow?**
It is the order in which a program, that contains more than one statement, executes.

*** What is conditional execution?**
The program is executes if a certain condition hold. With conditional execution we have at liest 2 conditions.

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

1 Like
  1. an expression is any piece of code that returns a value, expressions can be layered with other expressions making larger expressions.

  2. a binding is a special rule for a variable involving a key word to give direction to the binding. consider the words DO and SOMETHING. DO is the special word and SOMETHING is the variable. Together they form a binding.

  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. prompt(“enter password”); this is used for a website to log into a account. the prompt function is just a dialog box you can put any text in. you also have; catch, export, static, throw.

  6. a side effect is something that the function is producing. the side effect of promt is that it gives you a little box to type some text in it.

  7. A. promt(“enter password”); B Math.max(2, 4)

  8. control flow is simply the order in wich we code and have our statements evaluated.

  9. a conditional execution is the operation of code where certain condition in order for a particular is to be conducted. this is usually conducted by logical operators to determine the outcome of the code.

  10. if, else, while or loop.

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

  2. A binding is the name of a given variable that points to its subsequent value, for e.g apples = 3. In this example ‘apples’ is the binding.

  3. Collection of bindings and their values at a given time.

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

  5. function AddAges ( Age1, Age2)
    return Age1 + Age2,

  6. A side effect is the result production of a function.

  7. prompt('enter password")

  8. Control flow is the order in which code is executed, it is executed from top to bottom as if it is a story.

9.A conditional execution allows the program to take the appropriate route based on the data of the current circumstances. This creates branches in the program for all possible routes.

  1. If, else

1 Like
  1. It is a piece of code that gives out content.
  2. It is a relation built between two values.
  3. Environment is all the bindings within which the program functions.
  4. A function is a piece of program enclosed in a ‘bag’ with another value as a tag attached to it.

function square (a) {
return "the square of " a " is " + (a*a) + “.”;};

  1. Side effect is an action of a program making a change.

  2. a) side effect -> see p. 5
    b) value
    function square (a) {
    return a^2;};

  3. Control flow is the order in which the actions in the program are executed.

  4. Conditional execution is the possibility of the program running the code depending on the situation.

  5. The keyword is “if”

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

  2. To catch and hold values.

  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 password”);

  6. Showing a dialog box or writing text to the screen is called a side effect.

  7. Producing side effect:
    alert(“hello”)

    Producing a value:
    a=3; b=2; value=(a+b)
    5

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

  9. Conditional executions are used to decide the flow of execution based on different conditions. If a condition is true, you can perform one action and if the condition is false, you can perform another action.

  1. if
    else if
    else
1 Like
  1. An expression is defined as anything that produces a value,
    Ex.
    2 + 2
    4 / 8
    7 * 6
  2. When a value is assigned to a variable, binding them together.
  3. The set of variables and bindings at any specific time in a program.
  4. Piece of program that is wrapped in a value.
  5. prompt(“What is your name?”)
  6. Change of the code that alters the following outcome of the program.
  7. Side effect / Value
  • alert(“This box is the side effect from the alert function”);
  • console.log(Math.max(6 * 7, 8 * 5));
  1. Control flow - Is the order that a program is executed, the program always reads line by line and executes before moving on to the next line.
  2. Conditional execution - Is the order that a program is executed, a program may have different statements that leads to different paths depending on the input to it.
  3. Below are different types that can be used.
  • if {
    }

  • if {
    }else{
    }

  • if {
    }else if {
    }else{
    }

1 Like
  1. expression = fragment of code that produces a value
  2. binding = variable, connects two things
  3. environment = collection of bindings & their values
  4. function = piece of program that performs a task
  5. console.log is a function
  6. A side-effect = impression on the ‘world’ ie. browser
  7. Side-effect - prompt, value - Math.max
  8. control flow = the path the program takes
  9. conditional execution = various paths
  10. to invoke conditional execution = if keyword
1 Like

1 - An expression is a fragment of code that produces a value or side effect
2 - A binding basically catches and holds values (or tags them)
3 - An environment is like a list of collection of bindings that exist in a given moment. There are prepopulated enviroments as well
4 - A function is program wrapped in a value, which performs a certain task
5 - alert “I am a function!”

6 - A side effect results from an expression, and is a change to the “world” around it.
7 - Side effect function: alert " I am a function"
Value function: let number = 10
function = (number*5);
8 - Control flow: the order of execution, particularly when “if” or “while” functions are included.
9 - A function executed only under certain circumstances
10- If or while

1 Like