1. Describe one thing you’re learning in class today. Why do you think it will be important in your future web development journey?

Classes are in fact “special functions”, and just as you can define function expressions and function declarations, the class syntax has two components: class expressions and class declarations.

class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
// The constructor method is a special method for creating and initializing an object created with a class. There can only be one special method with the name "constructor" in a class. A SyntaxError will be thrown if the class contains more than one occurrence of a constructor method.

Can you offer a use case for the new arrow => function syntax? | Arrow functions work really well for methods like map.

How does this new syntax differ from the older function signature, function nameFunc(){}, both in style and functionality? | Arrow functions make code more concise, and simplify function scoping and the this keyword.

Explain the differences on the usage of foo between function foo() {} and const foo = function() {} | The first is a function declaration, and the other is a function expression. The foo in the first example is the function name, and in the second it has been assigned to a variable.

Can you give an example for destructuring an object or an array?

let introduction = ["Hello", "I" , "am", "Sarah"];
let [greeting, pronoun] = introduction;

  1. Explain Closure in your own words. How do you think you can use it? Don’t forget to read more blogs and videos about this subject.

Closures are important because they control what is and isn’t in scope in a particular function, along with which variables are shared between sibling functions in the same containing scope. Understanding how variables and functions relate to each other is critical to understanding what’s going on in your code, in both functional and object oriented programming styles.

You create a closure whenever you define a function. Then when you execute functions, their closures enable them to access data in their scopes.