Javascript prototype inheritance

Hi, everyone I have very difficult time grasping prototype inheritance, I tried the materiel available in FCC , mdn and some posts on stackoverflow, it is too complicated its object having constructor having reference to other prototype that have constructor function and so on. and when you try to write inheritance construct you write something like this:

childclass.prototype = Object.creat(parentclass.prototype)
childclass.prototype.constructor = childclass

this is in-intuitive.

I am totally lost. can I move on without fully understand it?
And if yes, this raise a question in my mind can I skip the understanding of certain concepts and memorize the syntax and move on? does this accumulate flawed knowledge that will make writing code to solve problem difficult, if it even possible? I don’t know if I am able to memorize it as I said it is in-intuitive.

just started attending courses. hope I will succeed

1 Like

To your first question, you can always move on. You can also always come back to it again.

To your second question, I guess that depends on how much you are going to be writing/reading OOP JavaScript. But when it comes to other codebases out there your not going to be able to avoid it.

1 Like

It’s a large part of how JS works. It is important to understand at least the basics of how a tool works so that you can use it well, but not knowing exactly how it works won’t prevent you using it.

Yes. Yes it is. It does read like gibberish when you’re starting out. It even reads a bit like gibberish when you’re not starting out. But most of this is section is just trying to explain how a prototypal system works, and how you can use JS’ builtin methods to explore how it works. YMMV, but 99.99999% of the time you’re probably not going to write code that looks like that. You’re overwhelmingly likely to write code that uses prototypes at some point though, and it is possible that you’ll want to implement inheritance as well (which can be useful in some situations).

1 Like