JavaScript Best Practices - Using Prototypes

  Рет қаралды 44,199

O'Reilly - Video Training

O'Reilly - Video Training

Күн бұрын

Пікірлер: 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.
@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
@maker_aleks
@maker_aleks 4 жыл бұрын
Why not to use class PersonFactory () { ... } which is way more elegant than IIFE?
@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
@HenrryPires
@HenrryPires 4 жыл бұрын
Good video, i just learned something new
@regularviewer1682
@regularviewer1682 5 жыл бұрын
Very very good. Very straight forward, thanks!
@gagankhadanga5203
@gagankhadanga5203 4 жыл бұрын
Thank you mam
@EnzoAuditore
@EnzoAuditore 2 жыл бұрын
Thanks mate.
@maduron
@maduron 7 жыл бұрын
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...
@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 5 жыл бұрын
Instead of person argument he should have been used this keyword.
@FatsFalafel
@FatsFalafel 4 жыл бұрын
I thought classes are built to take care of this issue?
@wilwad
@wilwad 6 жыл бұрын
Sweet. Love programming
@ChhongMengly
@ChhongMengly 4 жыл бұрын
Nice video sharing
@adhoccreative9811
@adhoccreative9811 6 жыл бұрын
Excellent
@PheonixPhoenix101
@PheonixPhoenix101 6 жыл бұрын
Brilliant
@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
@jaydeepkasture8483
@jaydeepkasture8483 3 жыл бұрын
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
@Seedzification
@Seedzification 6 жыл бұрын
Wow... Is this 2010?
@rosshoyt2030
@rosshoyt2030 6 жыл бұрын
Lol *burn*
@MadBunnyRabbit
@MadBunnyRabbit 5 жыл бұрын
​@Internet Entity use TypeScript.
@frankvee
@frankvee 6 жыл бұрын
Oh my head hurts. lol
@MadBunnyRabbit
@MadBunnyRabbit 5 жыл бұрын
just use Classes instead. That's why they have been introduced in ES6.
@saucy05
@saucy05 6 жыл бұрын
my brain hurts
@rosshoyt2030
@rosshoyt2030 6 жыл бұрын
happens
@MadBunnyRabbit
@MadBunnyRabbit 5 жыл бұрын
just use Classes instead. That's why they have been introduced in ES6.
@赵三三弟
@赵三三弟 6 жыл бұрын
看起来不太刺激
@NoajmIsMyName
@NoajmIsMyName 4 жыл бұрын
I'm confused... Why is it True again ?
@haikusfrombuddha
@haikusfrombuddha 4 жыл бұрын
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
@MadBunnyRabbit
@MadBunnyRabbit 5 жыл бұрын
Um... ES6 anybody? Classes? Hello? What is this bullshit?!
JavaScript Question: What is a Prototype?
10:48
All Things JavaScript, LLC
Рет қаралды 39 М.
JavaScript Loops - Code This, Not That
8:36
Fireship
Рет қаралды 347 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 33 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 671 М.
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 43 МЛН
Optimize and Debug Spark in the Hadoop Ecosystem - Optimization Best Practices
18:36
O'Reilly - Video Training
Рет қаралды 6 М.
Javascript Best Practices - Improve Your Code
20:19
Monsterlessons Academy
Рет қаралды 2 М.
9.19: Prototypes in Javascript - p5.js Tutorial
19:24
The Coding Train
Рет қаралды 258 М.
Deep Foundations of Advanced JavaScript - Kyle Simpson - Frontend Masters
15:35
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 896 М.
Object Oriented JavaScript Tutorial #10 - Prototype
8:24
Net Ninja
Рет қаралды 199 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 840 М.
Javascript Clean Code Best Practices - 5 Tips for Coding Good
8:13
Monsterlessons Academy
Рет қаралды 1,3 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 33 МЛН