JavaScript Classes vs Prototypes

preview_player
Показать описание
This tutorial discusses the differences in syntax between creating objects in javascript with the class keyword or with the prototype methods.
Examples are given of doing the exact same things with both versions.
It is important to understand that the class syntax is being interpreted as using the prototype syntax and that CLASSES do NOT exist in JavaScript.

Code Note: line 50 should be
We are setting the prototype of EmployeeP's prototype to link to the prototype of PersonP.
Рекомендации по теме
Комментарии
Автор

I can probably count on one hand how many truly clear and straight forward youtube coding tutorials I've watched, this is one of em, hitting subscribe!

judaspriest
Автор

Great video! Being an old-school C++ developer, I personally never understood why JavaScript ever needed to borrow the class syntax. One cannot really deny anymore that classes exists in JavaScript, they surely didn't. I prefer the syntax 'prototype' above 'class'. Many early C++ book editors around 1990 had a hard time explaining what a class is all about, almost apologetic for the confusing word choice. A prototype really says what it does, as it shapes how the instantiated object will look like, while a class has nothing to do with classification.

IONYVDFC
Автор

My head is still spinning, but this breakdown helped me understand how to use classes more. Thank you so much.

machineshouldbe
Автор

I never dreamed I can understand these class things, but after this tutorial, those abstract things go straight into my head without any resistance. legend teacher, as always thank you.

rotrose
Автор

I've been a Javascript programmer for more than 10 years, but suddenly, you opened my mind to a whole new sight to OOP in Javascript !!

NourHomsi
Автор

Steve, you are the ONLY ONE I found online, that explained well enough so I could understand, I always tried to find a relationship (a kind of "translation") between functions and classes and you simply explained it. Perfect video. Thank you very much.

igoroliveira
Автор

No bs, straight to the point, clear explanations with clear examples. So underrated!

Maru-gejn
Автор

"It is important to understand that the class syntax is being interpreted as using the prototype syntax and that CLASSES do NOT exist in JavaScript."

Great 👍

barungh
Автор

This is exacly what I'm looking for! Now it makes more sense why the syntax in class is constructed in a bit of a weird way. Many thanks!

sahasrabhujaneuron
Автор

I think in 11:16, the line should be Object.setPrototypeOf(EmployeeP.prototype, PersonP.prototype) instead.
Great video! I love it! <3

LR-bcjs
Автор

great way to explain, clear and in a not too fast speed, so the brain can follow. thank you for the great tutorial.

manjoujanzen
Автор

Omg! I finally understood prototypes - I have watched three different tutorials and I still did not get that...until I came across this video! Thank you so much!

Claudia-hzly
Автор

searching for a clear instructional video on this topic, finally found it. Thanks a lot.

josiahtobas
Автор

After 10 videos on constructors, classes, and prototypes in javascript, finally a video that makes me really understand....thank you.

pkn
Автор

A lot of libraries use the manual prototype method and there are some neat tricks you can do with it. I first saw this when analysing mongoose code.

There are some challenges if you want to represent this with types in a typescript project, I found using class syntax to be less pain in that regard.

JT-mrdb
Автор

such a good tutorial, you don't skip anything and actually understanding what's a class doing and how to simulate it using prototype explains the logic behind it.

adirbarak
Автор

This is so useful I cannot explain how much it made my learning prototype easy

abdouthiam
Автор

So happy I found your channel, I could cry! You’re making every subject I was shaky on just make sense!

JeatBunkie
Автор

What a clear and insightful video on what can be a very complicated concept! I've saved your 'JavaScript from the start' playlist and will be working my way through, one per day. Thanks Steve for the great education!

glenottley
Автор

Thank you so much. I am not good at english but your explanation is amazing. I can understand whole things. Thank you.

aaaaaab