Binding, Functions and Control Flow - Reading Assignment


#382
  1. What is an expression?
    It is a piece of code that originates a value.

  2. What is a binding?
    A binding is a name we can create that can grasp and hold a value. We can then use that name in expressions to refer to that value. It stands in the memory, so it can be used later, but it can be changed to refer to a different value or no value at all.

  3. What is an environment?
    An environment is the collection of bindings and their attributed values that exist at any given time.

  4. What is a function?
    A function is nothing more than a program. We can have a binding attached to it and call it by using that binding.

  5. Give an example of a function.
    alert(“Hello, World!”);

  6. What is a side effect?
    A side effect is the result of an expression that changes the visible environment like writing text to the screen or prompting a dialog box.

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

console.log(1+1);

  1. What is control flow?
    It is the order by which the statements are read and executed.

  2. What is conditional execution?
    Means that the program will execute one branch of statements instead of another based on which conditions are met during the program’s execution.

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


#383

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

2. What is a binding?
A binding is a way for the program to keep an internal state and to remember things. Binding allows us to easily set which specific object will be bound to this when a function or method is invoked

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

5. Give an example of a function.

function myFunction (p1, p2) {
return p1 * p2; // This function returns the value of p1 multiplied by p2
}

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

console.log (Math.max (100, 200));
// --> 200 (sife effect example)

console.log (Math.min (1000, 2500) + 5) ;
// --> 1005 (value example)

8. What is control flow?
Control flow is the order in which a computer executes statements. They are executed from top to bottom

9. What is conditional execution?
uses the “if” keyword. If the condition is respected, the statement will be executed, if it is not respected, it will not be executed. Certain parts of the code are only executed if certain conditions are fulfilled.

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


#384
  1. Expression is a piece of code, that holds value.
  2. Binding is a process of assigning a variable in a flexible way, so that a value could always be changed.
  3. Environment is a place where all bindings with their values are stored. For instance, a web browser.
  4. Function is a part of the program wrapped in value.
  5. alert ( );
  6. When the program does something visible, like opens a pop-up window, for example, it’s called side effect.
  7. alert ( ) produces side effect; math.max ( ) produces value.
  8. Control flow is a way of executing a program.
  9. If a program has more than one scenario in it, depending on user’s actions it’ll execute itself accordingly.
  10. if, else.

#385
  1. What is an expression?
    It is a fragment of a code. All values or operations.
  2. What is a binding?
    It is attaching a value to a name. This is the way of storing value in JS
  3. What is an environment?
    All bindings in the time being called the environment for that specific timeframe.
  4. What is a function?
    An exacutable program wrapped to a value
  5. Give an example of a function.
    console.log(“Example given”)
  6. What is a side effect?
    if an expression effects the statement that comes after it, it is called “side effect”
  7. Give an example of a function that produces a side effect and another function that produces a value.
    function sum(a,b) {
    return a+b
    }
    function Avarage(a,b) {
    return sum(a,b)/2
    }
  8. What is control flow?
    The order of a code
  9. What is conditional execution?
    The code only executes if a certain condition is met
  10. What kind of keyword do you need to use to invoke conditional execution?
    if

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

  2. What is a binding?
    A binding is like a hook that catches and hold values. It does not contain value, a binding just grasp them from the expression.

  3. What is an environment?
    An environment is a collection of bindings ( and by default their values ) that exists 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 ; console.log ;

  6. What is a side effect?
    A side effect is a dialog box or a writing text that appears on the screen after applying/invoking a function.

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

prompt (“Enter password”)

console.log ( one + two );

  1. What is control flow?
    A control flow is when a program have more than one statement and since they need to be executed in order, they do so like an story, from top to bottom.

  2. What is conditional execution?
    A conditional execution is when the program have two options to execute a value.

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


#387

1.Which type of developer programs the code that users interact with directly? Frontend
2.In web-development, what languages does a frontend developer typically use? HTML,CSS,JS
3.Which type of developer is responsible for making sure the logic of the application runs smoothly? Fullstack
4.Which type of developer is responsible for handling databases? Backend
5.Which languages can you use in order to communicate with a database (give 2 examples)? SQL,MDAC


#388
  1. A fragment of code that produces a value is called an expression.
    After a binding has been defined, its name can be used as an expression.

  2. JavaScript provides binding, or variable to catch and hold values.

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

  4. Function is a piece of program wrapped in a value.

  5. For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input.

  6. Side effect definition is - a secondary and usually adverse effect.

  7. Showing a dialog box or writing text to the screen produces side effect and the function Math.max takes any amount of number arguments and gives back the greatest produces value.

  8. Control flow is when your program contains more than one statement, the statements are executed as if they are a story, from top to bottom.

  9. Code to be executed if, and only if, a certain condition holds, that´s a conditional execution.

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


#389
  1. An expresion is a part of code that produces a value.
  2. Binding or variable is used to hold a value in the memory of our computer.
  3. Collection of all bindings alongwith their values in the memory at a given point of time is called environment.
  4. A piece of progrm contained by a value is called a function.
  5. console.log(‘Hello World’);
  6. It is the effect caused by the function like showing a dialogue box.
  7. alert(‘WARNING!’);
    Math.min(2, 4);
  8. It is the order in which the program is executed by the computer.
  9. It means that how the program should get executed in a particular situation.
  10. if keyword

#390
  1. Which type of developer programs the code that users interact with directly?
    It’s front end dev

  2. In web-development, what languages does a frontend developer typically use?
    They can be HTML, CSS or Javascript

  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    They are back end devs

  4. Which type of developer is responsible for handling databases?
    Back end devs

  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    MySQL, PostgreQL, Microsoft SQL


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

  2. What is a binding?
    A binding is a variable–something used to catch and hold values to be used later.

  3. What is an environment?
    The collection of bindings and their values including those that are part of the language and usually ways to interact with the system such as mouse and keyboard input.

  4. What is a function?
    A piece of program wrapped in a value that is applied to run said wrapped program

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

  6. What is a side effect?
    An expression that changes the state of the machine that will effect statements that come after it.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    alert(“I’m alerting you of something possibly important”);
    console.log(Math.max(3, 9));

  8. What is control flow?
    The process by which your program executes top to bottom, like a story.

  9. What is conditional execution?
    The path that a program will take based on the situation at hand using the if keyword.

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


#392
  1. What is an expression?

An expression is a combination one or more constants, variables, operators, and functions that the programming language interprets and evaluates to a single value.

  1. What is a binding?

In computing, a binding from a programming language to a library or operating system service is an application programming interface (API) providing glue code to use that library or service .

  1. What is an environment?

An environment is a collection of variables and their values that exist in a program at a given time.

  1. What is a function?

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

  1. An example of a function:

Function myFunction(a*b)

{ return a*b;}

This function returns the product of a*b

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

  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 the function that is found inside the alert variable in a browser environment. It shows a dialog box with a message. It goes like this:

alert(“Good morning!”);

An example of a function that produces a value is the Math.max function that takes two arguments and returns the largest of the two.

Math.max(2,4);

4

  1. What is control flow?

Control flow within a program takes place when statements are used to determine whether other statements are executed. This also applies to repeated execution of a block of code.

  1. What is conditional execution?

Conditional execution takes place when you do not want all the statements in your program to be executed in the same order. In this case the keyword if can be used to execute or skip a statement depending on the value of a Boolean expression.

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

The if keyword can be used to invoke a conditional expression.


#394

1.What is an expression?

A fragment of code that produces a value is called an expression. In terms of language, an expression is a sentence fragment, a JavaScript statement is a full sentence and a program is a list of statements.

2.What is a binding?

JavaScript provides something called a binding, otherwise known as a variable to catch and hold values. This is done using the keyword “let”, e.g. “let three = 3;”. This means you can then use the word “three” instead of the number 3 in calculations, e,g. “console.log(three * 3);” will produce 9. As well as using let, you can also use “var” and “const”.

3.What is an environment?

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

4.What is a function?

A function is a piece of program wrapped in a value, e.g. the function “prompt” will create a dialog box prompting the user for input with “ok” and “cancel” buttons. These values which are functions exist in the default environment.

5.Give an example of a function.

You can invoke a function by putting parentheses after it, e.g. prompt(“Enter name”) will cause a dialog to appear asking the user to enter their name.

6.What is a side effect?

The dialog box appearing due to the invoking of the prompt function is a side effect.

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

The function “prompt” produces the side effect of a dialog box appearing.

A function that produces a value is Math.max which will produce as a value whichever number is the greatest, e.g. “Math.max(8,16,32)” would return the value 32.

8.What is control flow?

Control Flow is how your program runs the code line by line.

9.What is conditional execution?

Conditional Execution allows the control flow to branch off and follow different paths, depending on the situation.

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

The keyword “if” invokes conditional execution, causing the program to branch off and follow a certain path. This means a section of code executes only if a certain condition arises. Using the keyword “if” allows you to determine what that condition is.

You can also use the keyword “else” to determine the code that executes in the alternative path.


#395

1. What is an expression?

A fragment of code that produces a value

2. What is a binding?

Its how a program assigns (binds) a value to a variable name. The program will create a space in memory and give it a name (the variable name) and then assign (bind) a value to it.

3. What is an environment?

The collection of variables 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.

JavaScript’s internal Math.max, gives you the maximum (highest) number from a set of numbers

6. What is a side effect?

showing a dialog box — alert (“Good Morning”) or

the output displayed when using console.log are both side effects

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

side effect function = alert(“Hello world”);

value function = console.log(Math.max(1,4,5,7));

8. What is control flow?

when your program contains more than 1 statement where each statement is executed one after the other

9. What is conditional execution?

when your program contains more than 1 statement where each statement is NOT executed one after the other, can jump from one statement to another based on its Boolean expression

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

IF


#396
  1. variables are expressions.
  2. if you declare a vaiable with = operator then you binding them.
    3.operators and rules that already exist on the system…even before coding.
    4.a block of statement ,rules which produces values.
    5.to do a math problem: function myfunc() { a=2 ; b=3 ;z = a+b ; alert(z); }
    6.if a function returns a box on the screen it is side affect.
    7aller()
    8.statements are read by computer one by one …from beginning to the end.
    9.executing is up to a condition…
    10.if ,while,do

#397
  1. What is an expression?
    Is a part of a code that produce values.
  2. What is a binding?
    Is a connection of variable and its content.
  3. What is an environment?
    Is a collections of binding.
  4. What is a function?
    A program wrapped in a value.
  5. Give an example of a function.
  6. What is a side effect?
    A return value of a function or program.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    console.log(3+2);
    //5
  8. What is control flow?
    The order of the commands is executed. In normal cases is generally from top-bottom.
  9. What is conditional execution?
    Conditional execution is depends if the condition is fulfilled it will do a particular task or execute a particular code.
  10. What kind of keyword do you need to use to invoke conditional execution?
    if, else if, else

#398
  1. What is an expression?
    A fragment of code that produces a value is called an expression. It is the simplest kind of statement with a semicolon after it

  2. What is a binding?
    A variable used by a statement to catch and hold values

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

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

  5. Give an example of a function.
    Prompt function in a browser environment

  6. What is a side effect?
    A change caused by a statement that counts as changing the world or changing the internal state of the given computing machine.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Prompt function gives a side effect - prompt("Enter passcode");

Math.max function gives a value - console.log(Math.max(2, 4));

// → 4

  1. What is control flow?
    The orderly execution of statements, contained in a program, from the top statement to the bottom statement.

  2. What is conditional execution?
    The orderly execution of only statements that satisfy respective conditions, contained in a program, from the top statement to the bottom statement.

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


#399
  1. What is an expression?
    An expression is a fragment of code that produces a value.
  2. What is a binding?
    A binding is a statement that will catch and hold values. It is also called a variable.
  3. What is an environment?
    It 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”);
  6. What is a side effect?
    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.
    prompt(“Enter passcode”); is a function that produces a side effect
    console.log(Math.max(2, 4)); is a function that produces a value.
  8. What is control flow?
    Control flow is the order in which the statements are read by the program. It goes from top to bottom.
  9. What is conditional execution?
    A conditional example is when we create a branching road, where 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?
    The keywords are if and else.

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

  2. A Binding is the way the program keep an internal state & remembers things.

  3. Collection of bindings & their values that at a given time is called an Environment.

  4. A Function is wrapped that performs a specific task.

  5. Alert(I am the greatest programmer).

  6. A Side Effect is an observable change in the state of the application.

  7. prompt (“Enter your name”) value example; console.log(Math.max(2,4)) it will output a value that is 4.

  8. Control Flow is how the program is executed.

  9. Conditional Execution is created with the if keyword in JavaScript.

  10. If, while and do loop.
    .


#401

An expression is a fragment of code that produces a value. A binding is a variable that involves the internal state of a program. It grabs values and remembers values. An environment is a collection of bindings and values at any given time. A function is a piece of program in a value.For example entering a password in a password box. The ‘prompt’ is the binding, that holds the ‘function’ which shows the dialogue box. The browser is the environment. The function is something that needs to be executed. A side effect is something that changes a value outside its local environment that was not the main intent. Technically showing a dialog box or writing text to a screen is a useful side effect. For example as what takes place in the console log.However a function will not need a side effect if it returns a value e.g : the function Math.max. The function will convert a number. A” control flow” is a number of statements( expressions) that support interactivity in a program. The statements are separated by semi colon. A conditional execution( block of code) can be followed through if a specified condition is true. If this is true, then that can happen. For example if the time is less than 20:00 then “good day” via console log and JavaScript. The “ If / else” is the keyword to invoke conditional execution.


#402
  1. It is a small part of code that gives a value.

  2. It is the way that a program remembers the values associated with an expression. You assign a word to a certain value, then you can use that word to fetch the value, because the two are binded together.

  3. It is the collection of bindings that exist at a given moment. The environment is never empty, as there are bindings that are needed to make JS functional.

  4. It is a piece of program wrapped in a value. They are useful to condense more complex statements, so that we can run them later.

  5. prompt(“Pick a Number”);

  6. If a statement produces a permanent change in the program after it, that is called a side effect of the statement.

  7. Side effect: prompt(“Enter password”);
    Value: console.log(1 + 2);

  8. It is the order in which the program is read and executed. Typically one-way up-down.

  9. The program will execute the given statement only if it determines a prerequisite condition has been met.

  10. if