React Continued

Welcome to my blog post from my tenth and final week of JavaScript Intermediate class!

Erin McBride
3 min readJun 9, 2019

Describe one thing you’re learning in class today.

I learned that nothing is better for learning how to code than working on projects. Reading about concepts is one thing, but seeing them in action is a better way to understand the concepts.

What is a closure, and how/why would you use one?

A closure is a feature in JavaScript where an inner function has access to the outer (enclosing) function’s variables.

Source: https://www.freecodecamp.org/news/javascript-closures-simplified-d0d23fa06ba4/

How would you describe the relationship between closure and functions?

See the answer to the last question.

What’s a typical use case for anonymous functions?

Anonymous functions are declared using the function operator instead of the function declaration. You can use the function operator to create a new function wherever it’s valid to put an expression. For example, you could declare a new function as a parameter to a function call or to assign to a property of another object.

Source: https://helephant.com/2008/08/23/javascript-anonymous-functions/

What’s the difference between .call() and .apply()?

The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly.

Source: https://stackoverflow.com/questions/1986896/what-is-the-difference-between-call-and-apply

Explain how this works in JavaScript?

This is one of the hardest concepts I’ve attempted to wrap my mind around, but here is the simplest explanation I’ve found: “The JavaScript this keyword refers to the object it belongs to.” this has different values depending on where it is used, but the basic concept remains the same.

Source: https://www.w3schools.com/js/js_this.asp

Explain how prototypical inheritance works.

I think the correct term is Prototypal Inheritance, not prototypical. This was and still is very difficult for me to understand, but here was the best answer I could find:

“When it comes to inheritance, JavaScript only has one construct: objects. Each object has an internal link to another object called its prototype. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. null, by definition, has no prototype, and acts as the final link in this prototype chain.”

Source: https://blog.bitsrc.io/understanding-javascripts-prototypal-inheritance-354292253bcb

How would you describe the relationship between objects and prototype?

I’m unclear as to how this question differs from the previous question.

What do you think of AMD vs CommonJS?

AMD and CommonJS are both Javascript module loaders. Javascript module loaders let us separate our code into modules and include a specific module in another module. This lets us import what module is required and load only the necessary.

This concept sounds similar to components in React, although I am not sure due to my lack of experience using them so far. If they are, then my opinion is that they would improve the loading time for applications.

Source: https://medium.com/@rlynjb/js-interview-question-what-do-you-think-of-amd-vs-commonjs-71defa831c50

--

--

Erin McBride

Hi there! Below is my weekly blog that I wrote while enrolled in Austin Coding Academy.