Static Methods in JavaScript Classes

preview_player
Показать описание

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

Hey Stephen! Just wanted to point out that this video is number 5 in the playlist and comes after the extends and super keywords video. Cheers for the great tutorials.

deuce
Автор

I was sent here from the Odin Project. This video, the set/get videos, and the extends/super video were SO helpful in cementing these concepts in my mind. You do a great job of breaking down these concepts into easily understandable parts and explaining why someone might need e.g., static methods. Thank you for these videos!

alexandravining
Автор

After scouring the net for hours, i found this to be the simplest explanation by far!

dehsenr
Автор

This static property worked just fine without error: static species = "Things" I guess JS has adopted it? Thanks for the awesome video series on Classes

jeff-creations
Автор

"species" is sucha great example of a static value

littlebrotha
Автор

Thank you for the videos. I was send to this from the Odin Project. Some of concept about Classes such as Static Methods was not clear for me. Now I clearly understand those concepts.

chamcham
Автор

am currently on the 5th playlist 3 to go but so far all i can say is that thank you well understood and you explained them in manner that is so easy to understand am grateful

ianmoon
Автор

There is a mistake that happened in 7:09. You could've made a static property into a regular variable also, not only a function, and the reason you got that Syntax Error is because you forgot to remove the () from species in the speciesSentence static method's return, It's not a method now, it's a variable.
Anyways, Great job you did in a great video, please keep on :D <3

mahmoudbakr
Автор

Wow, this playlist on JS classes really broke down for me what the MDN documents were trying to convey in a much more simplified and easy to understand way. Thank you Stephen! I can read back on the MDN docs and better grasp it as well.
It seems you haven’t uploaded in a while but I hope all is well. Just subscribed and will go through your other videos.

kode
Автор

Hello Stephen, thank you so much for your video. Just to make things clear (cause I'm not sure) - you mentioned in 0:52 that all properties and methods belong to the instances of the class. Doesn't it actually only apply to properties? Methods seem to be created directly on the prototype, which is a good thing. In order for a method to be included (copied) in every instance, it has to be declared in the constructor function.

AlpenTwix
Автор

This is the only video I understood while watching and I watched many .. Thanks for that :)

kingundfaker
Автор

I believe there is a point of confusion regarding the methods in the constructor version of the code. In the constructor version, you define methods using this.methodName = function(), which means the methods belong to each newly created object. However, when you transition to using ES6 Classes, you're actually leveraging JavaScript's prototype system. So, the statement that these methods belong to the created object might be misleading. The correct equivalent for defining methods in the constructor version would be Constructor.prototype.method = function() {}. Please correct me if I'm wrong.

deveren
Автор

Awesome vid! 1 question - is it better to attach non static methods to the prototype of the class rather than declaring them within the class? I’ve read that this saves memory, if this is true is there any use case for declaring methods within the class rather than on the prototype? Thanks!

badselection
Автор

Can you post Form Validation along with HTML output for Error Message Showing? Am very new to javascript learner

AntonyAllocious
Автор

thank you soooo much for this amazing explanation

sokainabn
Автор

Man, i haven't seen you for so long i thought you forgot this channel

tranhuy
Автор

WHAT?!
watched first 15 seconds and was horrified by the obvious HUGE mistake done transforming to a Class.
Before the methods were private and not shared across instances and afterwards they WERE shared.

yairvsync
welcome to shbcf.ru