Its worth mentioning that you are using factory pattern for object creation here. There are also constructor, prototype and dynamic prototype patterns.
@sebbes3335 жыл бұрын
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
@dragateli6 жыл бұрын
You should go over setting prototypes directly on objects, and that vs how you did it here.
@TheStevieharris5 жыл бұрын
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
@sujalkhatiwada22673 жыл бұрын
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.
@michealhall77765 жыл бұрын
Thanks this is what I have been looking for
@maker_aleks4 жыл бұрын
Why not to use class PersonFactory () { ... } which is way more elegant than IIFE?
@caribbeanman33796 жыл бұрын
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.
@jboxy5 жыл бұрын
Singleton pattern
@omg_look_behind_you5 жыл бұрын
@@jboxy seems like a good idea. I've never used a singleton pattern, but I'll just assume it'll work out.
@jboxy5 жыл бұрын
@@omg_look_behind_you it's almost exactly what you're doing or very close to doing :P
@HenrryPires4 жыл бұрын
Good video, i just learned something new
@regularviewer16825 жыл бұрын
Very very good. Very straight forward, thanks!
@gagankhadanga52034 жыл бұрын
Thank you mam
@EnzoAuditore2 жыл бұрын
Thanks mate.
@maduron7 жыл бұрын
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...
@2dabang5 жыл бұрын
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.
@MadBunnyRabbit5 жыл бұрын
just use Classes instead. That's why they have been introduced in ES6.
@SirusStarTV5 жыл бұрын
Instead of person argument he should have been used this keyword.
@FatsFalafel4 жыл бұрын
I thought classes are built to take care of this issue?
@wilwad6 жыл бұрын
Sweet. Love programming
@ChhongMengly4 жыл бұрын
Nice video sharing
@adhoccreative98116 жыл бұрын
Excellent
@PheonixPhoenix1016 жыл бұрын
Brilliant
@jsnode20757 жыл бұрын
What is the name of the extension to live preview on dev tool?
@jboxy5 жыл бұрын
That's developer tools, try Node REPL it's easy
@jaydeepkasture84833 жыл бұрын
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
@Seedzification6 жыл бұрын
Wow... Is this 2010?
@rosshoyt20306 жыл бұрын
Lol *burn*
@MadBunnyRabbit5 жыл бұрын
@Internet Entity use TypeScript.
@frankvee6 жыл бұрын
Oh my head hurts. lol
@MadBunnyRabbit5 жыл бұрын
just use Classes instead. That's why they have been introduced in ES6.
@saucy056 жыл бұрын
my brain hurts
@rosshoyt20306 жыл бұрын
happens
@MadBunnyRabbit5 жыл бұрын
just use Classes instead. That's why they have been introduced in ES6.
@赵三三弟6 жыл бұрын
看起来不太刺激
@NoajmIsMyName4 жыл бұрын
I'm confused... Why is it True again ?
@haikusfrombuddha4 жыл бұрын
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.
@karthickdurai21574 жыл бұрын
Couldn't understand, he's complicating it
@MadBunnyRabbit5 жыл бұрын
Um... ES6 anybody? Classes? Hello? What is this bullshit?!