Binding, Functions and Control Flow - Reading Assignment

  1. What is an expression? Every value that is written is an expression, ex 58 or physics.
  2. What is a binding? binding is to hold a value in javascript. we need bindings or variables.
    we use keyword like let folowed by the = operator and an expression.
  3. What is an environment? environment is a collection of bindings 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(“What is your name”);
  6. What is a side effect? Side affect is asking for users input.
  7. 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”));
    console.log(“your number is the square root of” + thenumber * thenumber);
  8. What is control flow? programs that contain more than one statement. The statement is executed as they are a story.
  9. What is conditional execution? this is when the program doesn’t have a straight path and we want to create a branch road based on the situation at hand.
  10. What kind of keyword do you need to use to invoke conditional execution? Some key words are if, else, else if.
1 Like

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

What is a binding?
Bindign gives and holds a value. However, it is possible to give new values with binding.

What is an environment?
The 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 username”);

What is a side effect?
A result of a function that is not the main purpose of it

Give an example of a function that produces a side effect and another function that produces a value.
alert(“oh no”);
console.log(Math.max(2, 4));

What is control flow?
The execution of the statements as if they are a story, from top to bottom.

What is conditional execution?
It is when the program takes the proper branch based on the situation at hand. Created with the keyword “if”

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

1 Like
  1. What is an expression? A fragment of code that produces a value. Any value that is written literally is an expression. What is written in parentheses is an expression. What is applied to both binary and unary operators are expressions.

  2. What is a binding? It allows a “new” value to be captured and stored. It requires a keyword to do so. And then the name of the binding. You must give it value for it to be stored.

  3. What is an environment? The collection of binding names and their values.

  4. What is a function? Is a piece of program from the default environment used to wrapped in a value.

  5. Give an example of a function. Square would produce the square of a value when called.

  6. What is a side effect? Something that is printed on the screen, or, a state that affects the statements that comes after it other than its return value.

  7. Give an example of a function that produces a side effect and another function that produces a value. Side effect. Prompt. Return value: Square or power.

  8. What is control flow? Statements are executed from top to bottom. And return values from higher statements are used in subsequent statements.

  9. What is conditional execution? The path the program takes is conditional on a condition being met. The program branches or forks off at that point.

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

1 Like
  1. What is an expression? A fragment code that produces a value.
  2. What is a binding? A variable that points to a value.
  3. What is an environment? a collection of bindings and there values.
  4. What is a function? A function in a section that provides a specific task.
  5. Give an example of a function. prompt(“Enter you date of birth”);
  6. What 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 one or more statements.
  9. What is conditional execution? A program that doesn’t always take straight line it could branch of.
  10. What kind of keyword do you need to use to invoke conditional execution? if, else, else, if
1 Like
  1. A fragment of code.

  2. Is a type of statement, such as var, a variable.

  3. The bindings and there values exist in an environment.

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

  5. alert(“Hello”);

  6. A visible change of the statement. A dialogue box, or writing some text in the screen.

  7. prompt?(“Enter Passcode”) is a function that produces a side effect.

And a value is, var a = 1

  1. When a program contains more than one statement. The statements are run as if they are a story.

  2. You create a branch road when the program looks like it is not following the path set, and you create a road where the program takes the proper road - conditional execution.

  3. if

1 Like
  • What is an expression?
    A fragment of code which produces a value. Can be between parenthesis as a binary operator between two expressions, or unary applied to one.

  • What is a binding?
    A way that the program catches and holds values together. It does this by using the word “let”. After a binding has been defined (e.g. let ten=10), it’s name can be used as an expression.

  • What is an environment?
    An environment is a collection of bindings and their values that exist at any given time. Even when a program starts up fresh, there is an environment which consists of the language standard.

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

  • Give an example of a function.
    For example, the word “prompt” is a function which creates a text box for the user to type in.

  • What is a side effect?
    Showing a dialogue box or writing text to a screen is a side effect.

  • Give an example of a function that produces a side effect and another function that produces a value.
    The function “console.log” produces the side effect of printing the text to the screen. The function Math.min is an example of a function which produces a value without a side effect.

  • What is control flow?
    Control flow is the order in which statements are carried out, depending on how the questions are answered. It is the flow of the story written into the code.

  • What is conditional execution?
    Conditional execution only occurs when some condition has been fulfilled (for example if a number is entered instead of a word).

  • What kind of keyword do you need to use to invoke conditional execution?
    You need to use the keyword “if” or “else” to invoke conditional execution.

1 Like
  1. it is a fragment of code that produces a value.

  2. it is a function that can catch and hold a value. when a binding points at a value, that does not mean it is tied to that value forever.

  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. in a browser environment, the binding “prompt” holds a function that shows a little dialog box asking for user input. prompt(“Enter passcode”);

  6. A side effect is an application state change that is observable outside the called function besides returning a value. 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. console.log(firstAccount);
    var firstAccount = accounts[0];

  8. It is the direction of execution of code in JavaScript which happens in a top down approach.

  9. 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. if, else, else if

1 Like

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

  1. What is an expression?
    A group of numbers, operators and symbols that gives a result as value.

  2. What is a binding?
    Is how a program keep an internal state by catching and holding values.

  3. What is an environment?
    Group of bindings and values.

  4. What is a function?
    Is a program wrapped with a value

  5. Give an example of a function.
    alert(Functions)

  6. What is a side effect?
    Like values, side effect is a product of functions and are designated as useful.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“password”); // sideeffect
    console.log(3-2); // value

  8. What is control flow?
    The execution of instructions in order of position, from top to bottom.

  9. What is conditional execution?
    An order or orders given to a program (If) to freely choose the way to take depending of the booleans value.

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

1 Like
  1. An expression is a program that produces a value
  2. It is a way catch and hold values
  3. It is a collection of bindings that exist at a given time
  4. It is a piece of program wrapped in a value.
  5. alert “Hola”
  6. A side effect is showing a dialog box or writing text in the screen.
  7. prompt ( “password”)
    console.log (a+b)
  8. The order in which statements in a program a executed in (Top to bottom)
  9. When a program has the option to take different paths.
  10. if/ else
1 Like
  1. An expression is any unit of code that can be evaluated to a value.
  2. A binding binds a couple pieces of information with each other.
  3. An environment is a collection of bindings and their values that exist at a given time.
  4. Basically a function is a piece of program wrapped in a values that exist at a given time.
  5. (“enter password”);
  6. 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 variables or object property.
  7. Side effect Prompt (“enter password”);
    Value function math.max (2,4); shows value 4
  8. Central flow is the order in which the computer statements in a script.
  9. Conditional execution occurs when the program executes certain key words i.e “if” are met.
  10. If is the most obvious keyword to invoke the conditional execution.
1 Like

1.What is an expression?

A fragment of code that produces a value is called an expression. Every value that is written literally (such as 22 or “psychoanalysis”) is an expression. Expressions can contain other expressions in a way similar to how subsentences in human languages are nested- a subsentence can contain its own subsentences, and so on.

2.What is a binding?

To catch and hold values, JavaScript uses binding, or variable.
It is a way how your program remembers things and stores them for later use.

3.What is an environment?

The collection of bindings and their values that exist at a given time is called the environment. Environment always contains bindings that are part of the language standard.

5.Give an example of a function.

function countApples (myApples,yourApples){return myApples+yourApples};

countApples(100,50);

150

This is an example of function that counts apples :slight_smile: or simple addition function that adds 2 values provide to it and returns a sum of arguments given to it.

6.What is a side effect?

When a statement in program makes a change in world, for example a dialog box popping up on screen- that counts as changing the world- or it could 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.

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

For example, the binding prompt holds a function that shows a little dialog box asking for user input. This is function that causes side effect.

For example, the function Math.max takes any amount of number arguments and gives back the greatest.

8.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. In some cases, it is straight line control flow and sometimes it can be conditional execution when sequence of execution has several branches. Control flow is basically when and what statement is executed.

9.What is conditional execution?

Conditional execution will make program execute statement only if certain condition is met.

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

Conditional execution is created with if keyword.

1 Like
  1. What is an expression?
    -Any piece of code that produces a value.
  2. What is a binding?
    -We use bindings to catch and hold values. The = operator can be used at any time to change the meaning of a certain binding. They are great to use to remember things.
  3. What is an environment?
    -The collection of bindings and their values that exist at a given time.
  4. What is a function?
    -Values that can be applied to run a wrapped program.
  5. Give an example of a function.
    -prompt : displays a dialog text box to the user.
  6. What is a side effect?
    -Things displayed on the browser such as a dialog box.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    -prompt produces side effect and Math.max produce values.
  8. What is control flow?
    -Statements in the JS are executed from top to bottom.
  9. What is conditional execution?
    -When we want o create a branching road if there is a certain situation met in the information being given to us.
  10. What kind of keyword do you need to use to invoke conditional execution?
    -let or/and if
1 Like
  1. A fragment of code that produces a value
  2. A binding is a statement that assigns a value to an expression
  3. A collection of bindings that exist at a given time
  4. A piece of program wrapped in a value
  5. console.log()
  6. It is when a function does something other than produce a value like showing a dialog box
  7. prompt() produces a side effect; Math.max() produces a value
  8. It is how the program is executed; the sequence of how the computer reads the code
  9. Conditional execution is when a piece of code is executed only when specific criteria are met
  10. If
1 Like
  1. An Expression is a fragment of code that produces a value.
  2. A binding is a thing that catches and holds a value. they are comparable to tentacles rather than boxes. They don’t contain values, they grasp them.
  3. An environment is the collection of bindings and their values that exist at any given time.
  4. A function is a piece of program wrapped in a value. These values can then be applied in order to run the wrapped program. As an example, the binding “prompt” holds a function that executes a dialogue box for data input.
  5. function multiplyTwoByTwo() = { return 2*2;}
  6. A side effect is any change that is caused by our code. some way in which we slightly “changed the world”. for example, a function may have an effect that is not visible right now, but comes in handy later.
  7. an example for a side effect would be something like a prompt for a name. an example for a value can be seen above (answer 5)
  8. the order in which the program executes its decisions. It could be linear, or it could be an if/else situation that will take a fork in the road basically…
  9. it is the situation where the program goes one way IF a given condition is there, and go another way if another condition is there.
  10. IF
1 Like
  1. An expression can be described as any part of code that produces a value. An expression can be literal as is in the case of the number 9 or a string such as “run”. An expression can even be contained within another expression by using parenthesis, as in the case where two expressions both contained within parenthesis have a binary operator between them. The fore mentioned line of code would be an expression in and of itself.

  2. A binding is a line of text that is used to link or “bind” that text to a value defined by the user. A binding can “let go” of a value and attach itself to a subsequent value defined by the user by re-invoking the binding name and attaching the new value on a line of the code that comes after the statement where the original value was “bound”.

  3. An environment is the entire set of bindings and values within a program. Usually there are preset bindings within most programs in order to assist in basic or commonly used functions such as tracking the location of the of the mouse pointer on the computer screen.

  4. A function is a program which needs to receive a value in order to run itself and return a new expression.

  5. Prompt

  6. A side effect is any meaningful change in the world that is caused by running a program. An example could be the accepting of a password in an entry field resulting in the side effect of a new web page being brought up on a screen containing personal or private information.

  7. A function that produces a side effect is Boolean. A function that produces a value is Math.max.

  8. Control flow can be described as a diagram displaying the order in which a program will run as well as what statements within the program will be executed depending what values are entered into each function within the program. A control flow chart should contain all possible paths of execution within a program.

  9. Conditional execution is when a function has more than one distinct subsequent statement of code that can be executed depending on what value is entered by a user. Conditional execution always has the capability or returning more than one distinct value in the console. In order for this to work the entered value has to meet a condition that is defined by an expression.

  10. if

1 Like
  • What is an expression?
    a fragment of code that produces a value
  • What is a binding?
    remembering a value
  • What is an environment?
    all bindings and their values existing in a particular moment
  • What is a function?
    a piece of program
  • Give an example of a function.
    prompt(“this text is an argument for the prompt function, so it knows what text to display in the prompt box”)
  • What is a side effect?
    The changing effect that a function has on it’s environment
  • Give an example of a function that produces a side effect and another function that produces a value.
    prompt(“this prompt box is a side-effect of the prompt function”); Math.max(a,b,c) returns highest value
  • What is control flow?
    executing code as a story from top to bottom, one line after the other
  • What is conditional execution?
    when the program has to options of paths to follow, and does not execute in a straight line.
  • What kind of keyword do you need to use to invoke conditional execution?
    if else elseif
1 Like

1.Expressions is code that produces a value
2.Binding is an specific instruction for a variable including a key word to give the direction to the binding
3.Is a collection of bindings that exist at a given time
4.functions are a part of programming thats wrapped in value.
5.(“enter password”)Prompt
6.a side effect is a change that effects the internal state of a machine in a way it will change the statements after it.
7.“confirm” function produces an added window.
8.the order of execution, eg straight top to bottom, in a conditional way or with loops
9.its an execution in which we can take two different routes based on the outcome value of a Boolean expression.
10.“if”

1 Like
  1. A fragment of a code that produces a value.
  2. It binds an object to a value.
  3. The collection of bindings and their values that exist at a given time.
  4. A piece of program wrapped in a value.
  5. alert(‘the message’)
  6. It can display something on the screen or it can change internal state of the machine in a way that will affect the statements that come after it.
  7. prompt(‘Enter password’)
    console.log(‘number’ + number)
  8. When there is more than one statetment in the program, the statetments will be executed from top to bottom.
  9. When the program chooses right output of a given input.
  10. if
1 Like
  1. A fragment of code that produces a value
  2. A binding “holds on” to a value for use in further instructions
  3. The environment is the collection of bindings that exist at a given time.
  4. A function is a type of value. It is a piece of program wrapped in a value.
  5. prompt(), console.log(), Math.max(), Math.min
  6. A side effect is the resulting change from an input
  7. When input is; 10 or less = small, 11-50 = medium, 50 - 100 = large.
  8. It is the route the syntax lays out. e.g. from here to there or, if here1, then there1. if here2, then there2, etc.
  9. If a defined condition is met, then it takes you to its corresponding route.
  10. “if” and/or “else”
1 Like
  1. What is an expression?
    A fragment of code that produces a value.

  2. What is a binding?
    A binding is what JavaScript uses to catch and hold values.

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

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

  5. Give an example of a function.
    let x=10;
    console.log(x + x);

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

  7. Give an example of a function that produces a side effect and another function that produces a value.
    a = “Hello World”;
    b = 2 + 2;

  8. What is control flow?
    When program contains more than one statement and the order in which they are executed from top to bottom.

  9. What is conditional execution?
    When a program is executed but the output depends on an if else statement.

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

1 Like