What is Factory Function in JavaScript - in 1 minute

  Рет қаралды 10,076

ColorCode

ColorCode

3 жыл бұрын

Factory Functions are an incredibly useful tool in JavaScript. It's a design pattern that's used in many languages. In this one minute coding video I will explain why they are useful, the problem they tend to solve, and a practical example. Enjoy!
#Shorts
=================
Sign up for an account on www.colorcode.io and watch full courses for free.

Пікірлер: 23
@TheEpicNoodle
@TheEpicNoodle 3 жыл бұрын
Wow it felt so good just getting the run down of this - so many tutorial videos full of fluff but this is right to the point with a real world example! Thank you
@ColorCodeio
@ColorCodeio 3 жыл бұрын
Glad it helped!
@elianrc
@elianrc 3 жыл бұрын
This is amazing! Thanks for this kind of video!
@ColorCodeio
@ColorCodeio 3 жыл бұрын
Thank you
@yatin1370
@yatin1370 7 ай бұрын
This was hugely helpful, understood the concept better. Thanks.
@ColorCodeio
@ColorCodeio 6 ай бұрын
Great!
@frostsmaker8966
@frostsmaker8966 3 жыл бұрын
I recommend you to make this kind of explanation, something short and concise is desirable by many people. :D
@ColorCodeio
@ColorCodeio 3 жыл бұрын
Thanks!
@JoaoVitor-pc4ps
@JoaoVitor-pc4ps 2 жыл бұрын
Your contents is helping me a lot! Thanks so much.
@ColorCodeio
@ColorCodeio 2 жыл бұрын
Happy to hear that!
@1Dshan
@1Dshan Жыл бұрын
I recently implemented a strategy pattern, for rendering cards on a page. The rendering logic was a little bit different for each card. Then I used a factory to instantiate the different strategies and pass the correct strategy too the view, worked really nicely
@mich_thedev
@mich_thedev Жыл бұрын
Nicely explained. Is that how react's jsx. Elements are made?
@PatrikRasch
@PatrikRasch 2 жыл бұрын
Quality.
@HigkeyRegarded007
@HigkeyRegarded007 2 жыл бұрын
mind blown.
@ColorCodeio
@ColorCodeio 2 жыл бұрын
🤯
@nabeelahmed1721
@nabeelahmed1721 3 жыл бұрын
Wow, I could see these being used to create a blockchain
@jeckart3d
@jeckart3d 3 жыл бұрын
Is this something that we should do to refactor Em’s rainbow?! Also, happy to see a new 1-minute vid!
@ColorCodeio
@ColorCodeio 3 жыл бұрын
Thanks, man :) There's going to be room for refactoring for sure, but I don't know if this particular pattern applies unless she's writing JavaScript.
@jeckart3d
@jeckart3d 3 жыл бұрын
@@ColorCodeio ahhhh, alright. I had thought what she was doing was based on JavaScript but in a “kid-friendly” wrapper.
@ColorCodeio
@ColorCodeio 3 жыл бұрын
@@jeckart3d Yeah I remember there was an option to write actual JS or use the visualizer tool to make it easier. I wonder if there's a full JS engine behind that thing. Probably.🤷🏻‍♂️
@killvapkillvaps3719
@killvapkillvaps3719 3 жыл бұрын
I 'm still confusing, why people use constructor functions if exists factory. Factory functions more flexible: it's not reqired 'this' and 'new' keywords, haven't privacy issues and don't have a problems with losing context with 'this' when we have a nested functions. Can you explain in which cases we should use 'constructor' ?
@ColorCodeio
@ColorCodeio 3 жыл бұрын
Yep, explaining that in episode 5.
@killvapkillvaps3719
@killvapkillvaps3719 3 жыл бұрын
@@ColorCodeio thanks, will waiting for new episode)
What is Factory Function in JavaScript? - JS Tutorial
17:31
ColorCode
Рет қаралды 55 М.
JavaScript Constructors in 1 minute #shorts
1:00
ColorCode
Рет қаралды 52 М.
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 17 МЛН
Alat Seru Penolong untuk Mimpi Indah Bayi!
00:31
Let's GLOW! Indonesian
Рет қаралды 16 МЛН
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 46 МЛН
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 22 МЛН
JavaScript Prototypal inheritance - Tutorial
15:29
ColorCode
Рет қаралды 71 М.
10 Design Patterns Explained in 10 Minutes
11:04
Fireship
Рет қаралды 2,2 МЛН
Immediately Invoked Function Expression | JavaScript | Malayalam | IIFE
13:45
Async Await vs. Promises - JavaScript Tutorial for beginners
24:30
Factory Functions in JavaScript
6:34
Fun Fun Function
Рет қаралды 211 М.
JavaScript Closures Tutorial (Explained in depth)
19:03
ColorCode
Рет қаралды 64 М.
What is Constructor Function in JavaScript? - JS Tutorial
17:40
TypeScript Factory Patterns (No BS TS Series 2 Episode 1)
22:07
Jack Herrington
Рет қаралды 34 М.
Async JavaScript & Callback Functions -- Tutorial for Beginners
24:21
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 17 МЛН