Do You Know How Classes Actually Work (JavaScript Prototypes)

preview_player
Показать описание
Do you know how classes are actually working in JavaScript? Object-oriented programming (OOP) exists in JavaScript, but using something known as prototypal inheritance to create an object prototype chain.

Prepping for your frontend interviews? Use code "conner" for a discount on my course FrontendExpert:

Рекомендации по теме
Комментарии
Автор

now it does more sense dude can't thank you more <3

magdykishk
Автор

Concise but informative. Great job, plaster keep it coming.

RsZ
Автор

Amazing bro thanks, best explanation Ive seen

raheem
Автор

Really really good explanation.Thank you very much

ocram
Автор

So I’ve only really programmed in Java and C so idk much about JavaScript but can you have class specific functions?

RandomYouTubevids-blsc
Автор

The properties or methods added to function prototype are instance methods and variables. Static methods and properties would be added to directly function itself like Math.sqrt.

orkhanhuseyn
Автор

The simplest way to think about it is that there are no classes in JS. It's all just runtime objects and functions (which themselves are special objects). When you say "let obj = new Foo()", you are telling the JS engine to do this (pseudocode):

let obj = new Object();


obj[[Prototype]] = Foo.Prototype

Foo.call(obj);

rumble
Автор

How do you create these animated videos?

sarimjokhio
Автор

Why not just use classes though?

It seems unnecessary and weird to me

(Genuine question btw)

Zzzzxx-qgcs
Автор

And the class keyword is an unnecessary weak fluff.

coderentity
Автор

i dont understand how classes and prototypes work, im cooked

dannyrose