Тёмный
No video :(

JavaScript Best Practices - Using Prototypes 

O'Reilly - Video Training
Подписаться 147 тыс.
Просмотров 44 тыс.
50% 1

Опубликовано:

 

27 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 41   
@twrkhanasparukh
@twrkhanasparukh 6 лет назад
Its worth mentioning that you are using factory pattern for object creation here. There are also constructor, prototype and dynamic prototype patterns.
@sebbes333
@sebbes333 5 лет назад
7:22 If you want to make the code even more wierd, you can return the person object directly, by changing row: 8 to this: *_return_*_ person = Object.create(personPrototype, {_ And remove the _return person;_ statement on row:15
@dragateli
@dragateli 6 лет назад
You should go over setting prototypes directly on objects, and that vs how you did it here.
@maker_aleks
@maker_aleks 4 года назад
Why not to use class PersonFactory () { ... } which is way more elegant than IIFE?
@TheStevieharris
@TheStevieharris 5 лет назад
when you think your finding your feet in programming and find a video like this. well explained and kinda understood, but forgotten all ready :p
@sujalkhatiwada2267
@sujalkhatiwada2267 3 года назад
Such video should be watched after knowing concepts of the IIFE and the scopes, execution content, variable environment, and things like that after practicing those things so that it makes clear sense to grasp the concept described in this video.
@michealhall7776
@michealhall7776 5 лет назад
Thanks this is what I have been looking for
@gagankhadanga5203
@gagankhadanga5203 3 года назад
Thank you mam
@HenrryPires
@HenrryPires 4 года назад
Good video, i just learned something new
@regularviewer1682
@regularviewer1682 5 лет назад
Very very good. Very straight forward, thanks!
@EnzoAuditore
@EnzoAuditore 2 года назад
Thanks mate.
@FatsFalafel
@FatsFalafel 4 года назад
I thought classes are built to take care of this issue?
@caribbeanman3379
@caribbeanman3379 6 лет назад
I like to create modules with all static functions, with one of them being a special "constructor" function for creating instance objects that the module works with. Then I just pass those instance objects as an argument to any static function that needs to work with instance data. So there's just one static version of all functions and simple data-only objects, without having to mess with ugly Object.prototype.whatever code.
@jboxy
@jboxy 5 лет назад
Singleton pattern
@omg_look_behind_you
@omg_look_behind_you 5 лет назад
@@jboxy seems like a good idea. I've never used a singleton pattern, but I'll just assume it'll work out.
@jboxy
@jboxy 5 лет назад
@@omg_look_behind_you it's almost exactly what you're doing or very close to doing :P
@maduron
@maduron 6 лет назад
Shouldn't the call operator "()" be within the embracing parenthesis? I feel that it would build a tighter bound between the anonymous function and its invocation in a single, ephemeral expression...
@ChhongMengly
@ChhongMengly 3 года назад
Nice video sharing
@wilwad
@wilwad 6 лет назад
Sweet. Love programming
@2dabang
@2dabang 5 лет назад
So, the only way to access johnDoe's greet() method is via another person object "janeSmith". That seems weird. I want to call greet() method as johnDoe.greet() and it should printout "john". That is more natural.
@MadBunnyRabbit
@MadBunnyRabbit 5 лет назад
just use Classes instead. That's why they have been introduced in ES6.
@SirusStarTV
@SirusStarTV 4 года назад
Instead of person argument he should have been used this keyword.
@PheonixPhoenix101
@PheonixPhoenix101 6 лет назад
Brilliant
@jaydeepkasture8483
@jaydeepkasture8483 2 года назад
what basically he did is he converted the greet method into a singleton, so whenever any person object is create they will all share the same greet method
@adhoccreative9811
@adhoccreative9811 6 лет назад
Excellent
@MylesGmail
@MylesGmail 5 лет назад
Thx!
@Seedzification
@Seedzification 5 лет назад
Wow... Is this 2010?
@rosshoyt2030
@rosshoyt2030 5 лет назад
Lol *burn*
@MadBunnyRabbit
@MadBunnyRabbit 5 лет назад
​@Internet Entity use TypeScript.
@jsnode2075
@jsnode2075 7 лет назад
What is the name of the extension to live preview on dev tool?
@jboxy
@jboxy 5 лет назад
That's developer tools, try Node REPL it's easy
@NoajmIsMyName
@NoajmIsMyName 4 года назад
I'm confused... Why is it True again ?
@haikusfrombuddha
@haikusfrombuddha 3 года назад
Before the factory would create its own function and stored it in memory. So everytime you created a new person a new function was also created. The thing is we want to just reuse one of those functions for all of the person's we create. So this made it so only one is created and when he tests it with === he could see that both person's created were using the same function instead of their own unique version of the function.
@karthickdurai2157
@karthickdurai2157 4 года назад
Couldn't understand, he's complicating it
@frankvee
@frankvee 5 лет назад
Oh my head hurts. lol
@MadBunnyRabbit
@MadBunnyRabbit 5 лет назад
just use Classes instead. That's why they have been introduced in ES6.
@saucy05
@saucy05 5 лет назад
my brain hurts
@rosshoyt2030
@rosshoyt2030 5 лет назад
happens
@MadBunnyRabbit
@MadBunnyRabbit 5 лет назад
just use Classes instead. That's why they have been introduced in ES6.
@user-uv4uj3df4g
@user-uv4uj3df4g 6 лет назад
看起来不太刺激
@MadBunnyRabbit
@MadBunnyRabbit 5 лет назад
Um... ES6 anybody? Classes? Hello? What is this bullshit?!
Далее