Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 1.47 KB

File metadata and controls

25 lines (14 loc) · 1.47 KB

Answer the following questions to the best of your ability. You can exercise your Googling skills and use training kit. Open up the Answers.md file and record your responses there.

Describe the biggest difference between .forEach & .map.

forEach doesn't actually return anything. It's just a simple for loop but simplified and better readability meanwhile map will return the current value in a new array without modifying the existing original.

What is the difference between a function and a method?

The only difference between the two is that a method is a function inside of an object class.

What is closure?

Closures are nested functions that can still access internal functions because inner function still has access to the outer function's variables even after the outer function has returned. Therefore, you can call the inner function later in your program.

Describe the four rules of the 'this' keyword.

Window binding: the value 'this' refers to the window or global object. Implicit binding: Inside a function the object before the dot is this New binding: When you use a constructor function this will refer to the object created and return with the constructor function Explicit Binding: Whenever you use a 'call' or 'apply' method. Apply method separates and console logs items individually and 'call' console logs items as a group.

Why do we need super() in an extended class?

Super is used to bind and call parent methods to extend parent functionality in the child class.