Binding, Functions and Control Flow - Reading Assignment

  1. a fragment of code that produces a value.
  2. to catch and hold values.
  3. collection of bindings and their values that exist at a given time.
  4. a piece of program wrapped in a value.
  5. prompt(“enter passcode”);
  6. change the internal state of the machine that affects the statements that come after it.
  7. console.log, Math.max
  8. when your program contains more than one statement, the statements are executed as if they are a story,from top to bottom

9.where the program takes the proper branch based on the situation at hand .

  1. created with the if keyword in JavaScript.
  1. Which type of developer programs the code that users interact with directly?

Ans. UI Developer or Front End Developer programs the code that users interact with directly.

  1. In web-development, what languages does a frontend developer typically use?

Ans. In web-development, A front End developer typically uses HTML , CSS , JAVASCRIPT , frameworks like Bootstrap and Angular , as well as JS libraries JQUERY.

  1. Which type of developer is responsible for making sure the logic of the application runs smoothly?

Ans. A backend developer is a type of programmer who creates the logic of a software application or information system.

  1. Which type of developer is responsible for handling databases?

Ans. A Back End Developer is responsible for handling databases.

  1. Which languages can you use in order to communicate with a database (give 2 examples)?

Ans. Ruby, PHP, Java, .Net, and Python…Ruby On Rails.

  1. Which type of developer programs the code that users interact with directly?
    A Frontend developer programs the layout of web page.
  2. In web-development, what languages does a frontend developer typically use?
    Frontend developers use; HTML, CSS, and JavaScript for programing.
  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    The Backend developer combines the interface with the user experience.
  4. Which type of developer is responsible for handling databases?
    The Backend developer programs comand logic into the database.
  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    Ruby Rails, PHP, Java…
  1. Which type of developer programs the code that users interact with directly?
    Frontend developers
  2. In web-development, what languages does a frontend developer typically use?
    HTML, CSS and JavaScript
  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    Backend Developers
  4. Which type of developer is responsible for handling databases?
    Backend Developers
  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    Python and MySQL
  1. Which type of developer programs the code that users interact with directly?
    frontend developer
  2. In web-development, what languages does a frontend developer typically use?
    HTML CSS Java Script
  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    Backend developer
  4. Which type of developer is responsible for handling databases?
    backed developer
  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    Ruby, PHP, Java, .Net, and Python
  1. An expression is representation of a value in code within a program. Expressions can be made up of multiple expressions nested within one another, this allows complexe computations to be made. expressions together make what are called statements, and a program is a list of statements.

  2. Binding is how a program ‘remembers’ values to be used later, you can also say that this is how a program maintains an internal state. We can set or bind variables to given values in Javascript by using the keywords let and var.

  3. An environment is a collection of bindings and their values. When a program starts, for instance a browser, it is not a blank slate it contains bindings that allow it to interact with your computer.

  4. A function is basically a program that is wrapped within a value.

  5. prompt(“I am a function”); or alert(“Ivan is cool”);

  6. a dialog box or text begin displayed is a side effect. For example if I enter alert(“Hello world!”) within the console of google chrome then the side effect will be for the web page to say “Hello world!”

  7. If I enter alert(“Hello world!”) within the console of google chrome then the side effect will be for the web page to say “Hello world!”. The function Math.min takes whatever number arguements it is given and gives back the smallest value. An example of Math.min would be console.log(Math.min(3, 4) + 150); which would result in the result 153.

  8. Control flow is the order that a program will run the code within it. This is done usually from top to bottom.

  9. This is where a program executes code depending on conditions such as a user interacting with a program with dependant input.

  10. if (to execute of specific block of code if a certain condition is held to be true) and else (the same as if but if the condition is false)

  1. A fragment of code that produces a value.
  2. This is variable which catch and hold values.
  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 (“ I am a function “);
  6. Is any application state change that is observable outside the called function other than its return value.
  7. confirm ( “yes or no?”);
    console.log (Math.min(2, 4) - 1);
  8. JavaScript supports a compact set of statements, specifically control flow statements, that you can use to incorporate a great deal of interactivity in your application.
  9. When we choose from two possible ways.
  10. the IF keyword.
1 Like
  1. What is an expression?
    A fragment of code that produces a value
  2. What is a binding?
    A binding is a tentacle, rather than a box, that allows to catch and hold values, so it can be used as an expression. It use to be defined by the binding word “var” up to 2015, but now we should rather use “let”.
  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. Such values can be applied in order to run the wrapped program.
  5. Give an example of a function.
    For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input.
  6. What is a side effect?
    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. Give an example of a function that produces a side effect and another function that produces a value.
    For example, the function Math.max takes any amount of number arguments and gives back the greatest.
    Anything that produces a value is an expression in JavaScript, which means function calls can be used within larger expressions.
  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.
  9. What is conditional execution?
    Not all programs are straight roads. We may, for example, want to create a branching road, where the program takes the proper branch based on the situation at hand. This is called conditional execution .
  10. What kind of keyword do you need to use to invoke conditional execution?
    Conditional execution is created with the if keyword in JavaScript.

Please check the link in " Blockchain Business Masterclass" Lesson Backend vs Frontend - Reading Assignment : It is wrongly being linked to this assignement!!

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

  2. Binding is a method used in Javascript to catch and hold values. Rather than containing values, bindings grasp them so it must always be given a value for it to be effective.

  3. An environment is 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. An example of a function would be using the binding prompt to hold a function to have a dialog box appear requiring input from the user.

  6. Side effects are changes to the internal sate of a program or machine that affect the statements that come after it. For example, showing a dialog box or writing text are considered side effects.

  7. An example of a function creating a side effect would be the alert or prompt function. A function that produces a variable would be Math.max which takes any amount of number arguments and returns the greatest value.

  8. Control Flow is how the value of expressions are controlled when coding.

  9. Conditional execution is when there are multiple options to execute a statement with, based on the situation.

  10. if is used to invoke a conditional execution.

  1. What is an expression?
    An expression is simply data expressed to JavaScript to be used for whatever logic is applied to it. 2 would be and expression and I can use 2 with a logic operator to get a result. 2+2 for example.

  2. What is a binding?
    This is when a expression is not just single use but rather stored in memory. Using let, var, or const.

  3. What is an environment?
    The environment is the big picture of the program. Like a file that contains bindings, expression, loops, logic, functions etc.

  4. What is a function?
    Functions are bits of code that are given a name and any time the are requested they take the same set of pre defined actions.

  5. Give an example of a function.
    A function could be called oddOrEven and just check if something a number is even.

  6. What is a side effect?
    Something that impacts another part of code but does not have an value output outside the program.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    A function to find odd numbers puts out a value. A function the that counts to 10 and lets another function know to do something else would be a side effect.

  8. What is control flow?
    The directions a program can go based on the conditions applied to it.

  9. What is conditional execution?
    Conditional execution is like if apples are red eat them else don’t eat it.

  10. What kind of keyword do you need to use to invoke conditional execution?
    if would execute based on expressed conditions.

What is an expression?

Using values and operators to get a result. Ex 1 + 2 in a expression that gives value

What is a binding?

Using let creates a binding that catches and hold a binding.

Ex. Let ten= 10;

Console.log(ten * ten)

//à 100

Where let gives the binding with the name of ten the value of 10 using the = operator. Using let makes the binding so that we can use the expression more than once, it will not disappear after being used the first time. But will change if we change the let binding. Binding are the strings that grabs the values inside the bag. Can also use var and const to create bindings.

What is an environment?

The collection of all the bindings and values in a program is called the invironment

What is a function?

A piece of a program wrapped in values. This program can be used to run the wrapped program. Executing a function is called invoking, calling, or applying it. You can call a function by putting parentheses after an expression that produces a function value. Values given to functions are called arguments.

Give an example of a function.

Ex. Using prompt alert to show a pop up to the user, this uses a function to make it show up

What is a side effect?

Writing text or show a dialog box creates side effects

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

Side effect;

Var name= “Anders”;

Const greeting= “Hey!”;

Console.log (greeting + name);

//à Hey! Anders

Value:

Let one= 1 , two= 2;

Console.log (one, two);

//à 3

What is control flow?

When program has more than one statement, they are executed like a story from top to bottom.

What is conditional execution?

If statement used when there`s a choice being made. A condition must be fulfilled to give a specific value. Ex. Only show numbers, not text.

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

If

  1. What is an expression?
    A fragment of code that produces a value. Expressions can come in different shapes. A value written directly (42 for example), an expression in parenthesis are also expressions and if they are combined with a binary operator, they are an expression too. We will always add a semi-colon at the end of each expression to form a JS sentence to avoid errors. The machine might consider that the next line of code is part of the same sentence.
    2. What is a binding?
    The mechanism JavaScript uses to catch and hold values. It allows you to give a name to a variable that you can then use and reuse throughout your code as an expression, for example
    let ten = 10;
    console.log(ten * ten);
    // → 100
    Bindings are not boxes we store things into, but rather strings that we attach to values that we can then detach and reattach to something else:
    let mood = “light”;
    console.log(mood);
    // → light
    mood = “dark”;
    console.log(mood);
    // → dark
    Creating a binding with no value behind it will give you undefined as a result.
    To define a binding, you may use
    let : It can define several bindings. Prefer this over var, which has specifics and is pre 2015
    var : Used to be the norm pre 2015
    const : Points to a constant value.

You can combine bindings to get the code to perform the action you want:
var name = “Ayda”;
const greeting = "Hello ";
console.log(greeting + name);
// → Hello Ayda
You may name your binding as you please, as long as it does not start with a digit, only uses $ and _ as special characters and does not contain keywords or reserved words from the JavaScript realm ( such as package, default or typeof for example). Console.log is the only binding name with a period. That is because it is a specific binding
3. What is an environment?
It is the collection of bindings and their values that exist at a given time. They are never empty. Even when a program starts up there always is some bindings that are part of the language standard, and or bindings that enable you to interact with the program, such as the ability to get input from the mouse and keyboard.
4. What is a function?
It is a piece of program wrapped in a value. Those values can be applied in order to run the wrapped program. Executing a function is called invoking, calling or applying it. You can do it by putting parentheses after an expression that produces a function value. The value in the parenthesis are given to the program and are called arguments.
To group any number of statements in a block, use braces {}.
5. Give an example of a function.
Console.log; alert; prompt etc… Number converts an input into a number, String converts it to a string type and Boolean to a boolean.
Number.isNaN, which is a standard and returns true only of the argument given is NaN.
6. What is a side effect?
A change in the internal state of the machine that affects the statements that come after a binding that I did. Showing a dialog box on the screen or writing text to the screen is a side effect for example. Should a function produce a value, they do not need to have a side effect (i.e. to change the world) to be useful.
7. Give an example of a function that produces a side effect and another function that produces a value.
Math.max(2, 4) returns 4 ( the max amount of the inputs I gave it) and does not have a side effect.
alert(“hello world”); produces a text box on the screen and therefore has a side effect.
8. What is control flow?
It is the execution of the statements of code from top to bottom. The computer will first read the first line of code and execute it and then the second one and execute it. Not all programs are straight roads though and we may need to branch the execution depending on the situation.
9. What is conditional execution?
It allows you to create branching roads based on the situation and execute the proper line based on the situation. Using the proper keyword, it executes or skips a statement depending on the value of a Boolean expression. You might want to define both the “happy path” and the alternative path. They can be chained in order to take into account many scenarios.
10. What kind of keyword do you need to use to invoke conditional execution?
if , which might be completed with the else keyword that defines the alternative path to be taken.
let num = Number(prompt(“Pick a number”));
if (num < 10) {
console.log(“Small”);
} else if (num < 100) {
console.log(“Medium”);
} else {
console.log(“Large”);
}
This program first checks if the number is less than 10, if it is it prompts Small, if not it checks if it is less than 100, if it is it prompts medium, it is not then it prompts large.

@ivan, I am a bit confused. I came to this page by following the link from the “back end VS front end” page of the " Blockchain Business Masterclass" which has a different set of questions (listed in a quotation outline below). Am I supposed to mix the answers? Or should I use a different page?
It would be nice to have a course page fixed and to have some redirect info at this one.

After you're done reading come back here and answer the questions below in Toshi Times Forum.

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

@ivan, I guess I’ve found the correct link. https://forum.toshitimes.com/t/backend-vs-frontend-assignment/6380
I hope it would be useful for the users who came here by accident from a completely different course.

  1. Which type of developer programs the code that users interact with directly?
    Front End
  2. In web-development, what languages does a frontend developer typically use?
    JavaScript, HTML, CSS
  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    Back End
  4. Which type of developer is responsible for handling databases?
    Back End
  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    Ruby and Python
  1. What is an expression?

A fragment of code that produces a value

  1. What is a binding?

A variable that holds a value

  1. What is an environment?

A collection of bindings and their values that exist at a given time

  1. What is a function?

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

  1. Give an example of a function.

Prompt or console.log

  1. What is a side effect?

Showing a dialogue box or writing text to the screen

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

console.log(Math.min(2, 4) + 100); console.log produces a side effect and math.min produces a value

  1. What is control flow?

Statements are executed in order, like a story

  1. What is conditional execution?

Using an If statement to branch program flow

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

“If” and “Else If”

  1. Which type of developer programs the code that users interact with directly?
    Frontend developer.

  2. In web-development, what languages does a frontend developer typically use?
    html, css, Java Script

  3. Which type of developer is responsible for making sure the logic of the application runs smoothly?
    Backend Developer

  4. Which type of developer is responsible for handling databases?
    Backend Developer

  5. Which languages can you use in order to communicate with a database (give 2 examples)?
    Phyton, PHP, Java, .NET and Ruby

1- An expression is a fraction of code that produces a value.
2- Binding is setting a value to a given variable.
3- The environment is the collection of bindings and their given values at a set time.
4- A function is a piece of program wrapped in a value. You apply the value in order to run the program.
5- An example function would be “console.log”. It writes out its arguments in a text output device.
6- A side effect is a change that a statement does in the world or in the internal state of the machine, instead of just showing a value.
7- The console.log function just shows a value, while the prompt function produces the side effect of showing a dialog box asking for user input.
8- Control flow is the order in which statements are executed, that is, from top to bottom.
9- Conditional execution is defining a condition for a given code to be executed. It will execute a code only when the specific condition is met.
10- For conditional execution, the keywords “if” and “else” are used.

  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. An expression between parentheses is also an expression. Expressions can contain other expressions in a way similar to how sub sentences in human languages are nested—a sub sentence can contain its own sub sentences, and so on. This allows us to build expressions that describe arbitrarily complex computations.

  1. What is a binding?

The first,var(short for “variable”), is the way bindings were declared in pre-2015 JavaScript. The word const stands for constant. It defines a constant binding, which points at the same value for as long as it lives. This is useful for bindings that give a name to a value so that you can easily refer to it later. The word const stands for constant. It defines a constant binding, which points at the same value for as long as it lives. This is useful for bindings that give a name to a value so that you can easily refer to it later.

  1. What is an environment?

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

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

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

  1. What is a side effect?

A lot of functions are useful because of the side effects they produce. Functions may also produce values, in which case they don’t need to have a side effect to be useful.

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

prompt(“Enter passcode”); gets you a function a little dialog box

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

  1. What is conditional execution?

Conditional Execution Is when we want some code to be executed if, and only if, a certain condition holds. We might, for example, want to show the square of the input only if the input is actually a number. the program takes the proper action based on the situation at hand.

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

Conditional execution is created with the if keyword in JavaScript. You can use the else keyword, together with if, to create two separate, alternative execution paths.