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.