What is Factory Function in JavaScript? This is episode 3 in a 10 part series I'm calling 10 Things JS Developers Should Know, but Probably Don't. 💻🤷🏻♂️💛
I discovered your channel two days ago and I'm still stunned by how good your videos are. The editing is super professional (really appreciating the background music), Explanations are so easy even a 5 year old can understand And you're hella funny. Thanks 10X
Just found your channel after watching a tonne of videos on JS Factory, you made things so much easier & simpler to understand, Hats off to you brother, genuinely loved your method of teaching & that soothing background soundtrack you had me absolutely focused from start to finish.
This man is absolutely mind blowing with his work, the video quality, the editing everything...and specially the explanation of the topic totally on point.... Channel definitely blowing up soon...
Hey Sina, Compelled to comment as I've been devouring these JS videos in a random order alongside a bootcamp i'm on. Almost anytime i get snagged up on something I'm back searching for a video on the topic. You seem a very natural teacher and obviously deeply understand your subject, unlike many other tutorials where it's just a telling of 'info', your videos are a true sharing of knowledge. Thanks sir.
I use factory functions for organizing an API I maintain. There's about a dozen "sections" of the API, so I split those sections into their own files and load them into a static object at runtime. It's much easier to maintain than a single file with hundreds of functions in it.
You don't know how much I appreciate for this series. Your contents are really helpful for beginners like me and at the same time also entertaining. Thanks brother. Salute 🫡.
Sina, YOU'RE AMAZING........ I didn't comment on RUclips videos, but YOUR CONTENT forced me to comment, and APPRECIATE YOUR EFFORTS. I REALLY LOVE your explanation and GRAPHICS. LOOKING FORWARD TO MUCH MORE FROM YOU :) THANKS
Great stuff. Liking your videos. I would caution you against writing static functions that assume a context. In this case you assume thw document object which you are using by interracting with you outter scope. This means your function cannot add elements to other scopes. What you should do is introduce an element object and act on it instead of document and document body. The dom heirarchy should be the context in this case
Awesome video! Learning about factory functions in my bootcamp right now and this really helped me better understand! The effects and music are high quality, and you break it down so well!🤓 I also really love when code content creators don't edit out their mistakes. It really helps to see possible bugs and fixes! And also encouraging to see people at this level are still human too 😅 Subscribed! Cheers!
Just want to add a thing. I belong to the old school where we were taught to keep an eye on your code's memory requirements. Duplicating code means more RAM is needed. This may not have a major effect on the front end, but on the back end, more RAM for the script can be an issue.
I have seen many tutorials but this one was the most definitive of them all. Great work brother! Would you suggest learning only classes or factory functions or is it necessary to learn both? For simplicity purposes could we just get familiar with one?
Modern JavaScript patterns are moving more toward functional programming and away from Classes. With that said I think any JS developer should have an understanding of both. They're not that difficult to learn.
@@ColorCode-io Alright.... Right now I'm trying to code a factory function that returns an object which is basically a button with a dropdown list when hovered over. Let's see how it goes!
Hi! I absolutely love your videos, they are extremely helpful in understanding such complex topic. Only one thing - the background music is either distracting (I have ADHD, so it already takes a huge effort to concentrate as it is), or way too soothing (literally makes me super sleepy even after a full night's sleep). Other than the background noise, I am very thankful that you created this series!
sir, please create a playlist for javascript. It will help every student who is learning javascript. your teaching method is very easy and gorgeous. thank you.
love your videos man! soo, soo awesome ! do you think, you can briefly describe when to use factory functions and when class? its really confusing me, because to me, factory functions seem to be much easier to use
Bro Awesome Video. Enlightened. 1 question - What's the difference between Class and Factory function, other than the OOPS concepts? I mean like memory usage, processing speed, etc
Love your videos. At around 9:00 you state that now using the factory function the Object's name can't be changed. It wasn't demonstrated there so it's a bit confusing.
Does this only work because of how closures work? me.name isn't actually a property so it can't be returned, because at time of object instantiation the closure referenced the passed in name and it (still don't know how it tracks this in memory) knows / has knowledge of what name it was given, but has no actual name property?
These are all design patterns agnostic to frontend or backend. It’s just a way of organizing code so you can def use most of the stuff I teach on backend. The only thing you can’t use it the DOM API which I sometimes use to provide examples.
Buddy, you have made a very good presentation. Even though the factory function can return h1, I think we can still modify the innertext without using the setText metod by just accessing the property by h1.el.innertext, is not true? For eg, below code snippet, function personFactory(name, age) { const person = { name: name, age: age } return { person, setName(name) { person.name = name; }, setage(age) { person.age = age; } } } const anonymous = personFactory('anonymous', 25); console.log(anonymous.person); anonymous.person.name = 'anonymous anonymous'; console.log(anonymous.person); How do you tackle such situtations?
What is Factory Function in JavaScript? This is episode 3 in a 10 part series I'm calling 10 Things JS Developers Should Know, but Probably Don't. 💻🤷🏻♂️💛
can you tell me what IDE YOU USE
I NEED HELP CAUSE EVERY TIME FOR PROTO AND INHERITANCE I HAVE TO DEVTOOL CONSOLE
@@Justnadeem it’s called RunJS. See here: runjs.app?via=colorcode
I request the government to give this man a medal at the government level for his high performance and excellent work.(A lot respect)
🙏🎖️ Thanks dude.
I discovered your channel two days ago and I'm still stunned by how good your videos are.
The editing is super professional (really appreciating the background music),
Explanations are so easy even a 5 year old can understand
And you're hella funny.
Thanks 10X
Holy shit, its so simple! I love it! Thank you!
Dude this is EXTREMLY good content.
Good graphics, good camera, funny and slow pase for my beginner brain.
This channel will blow up.
Thank you! :)
I appreciate that! Made my day.
@@ColorCode-io this is what Apples tutorial of JS Factory function would look like.
@@asdjafhjasbfhjasbhjf This
I am not even bored to watch it 5 times! Thank you for this videos.
Just found your channel after watching a tonne of videos on JS Factory, you made things so much easier & simpler to understand, Hats off to you brother, genuinely loved your method of teaching & that soothing background soundtrack you had me absolutely focused from start to finish.
Thank you! Glad it's helpful.
Yeah the quality kept going throughout. Incredible job. Thank you so much.
Glad you enjoyed it!
never seen such an amazingly explanatory video before. Great job
Thanks!
Thanks for covering factory function, Extremely helpful -- Thank you!
You're welcome!
This man is absolutely mind blowing with his work, the video quality, the editing everything...and specially the explanation of the topic totally on point....
Channel definitely blowing up soon...
Thank you!
I’m watching this like a t.v show. I enjoy this. Thank you 🙏🏾
Awesome 😀
Hey Sina, Compelled to comment as I've been devouring these JS videos in a random order alongside a bootcamp i'm on. Almost anytime i get snagged up on something I'm back searching for a video on the topic. You seem a very natural teacher and obviously deeply understand your subject, unlike many other tutorials where it's just a telling of 'info', your videos are a true sharing of knowledge. Thanks sir.
Great to hear. Thank you!
the quality production of this video is probably the best i ever seen on you tube ! ;) thanks
Thank you :) I put a lot of work into these so it's nice to hear.
I was thinking exactly the same. Great job.
@@danielbedoya6517 Thanks Daniel
1st time i didn't get bore while learning js ( best teach ever )
Excellent production quality. I am looking forward to seeing your channel grow.
Much appreciated!
Me too! His videos are very well done!
@@fParad0x_ thank you
You have a very pleasant and clear way of explaining things. Super good content thx!!
Ty!
Amazing description Sina, I am looking forward to seeing your new series about Js and React js.
Coming soon!
Amazing description Sina, Hope to see more video of yours dadash!
Sure thing. Episode 10 is coming this week!
you got a sub!! don't stop my dude don't stop!!! great content
Thank you so much
I'm only 3 minutes into this video atm but MAN this video is well made.
Thanks!
I use factory functions for organizing an API I maintain. There's about a dozen "sections" of the API, so I split those sections into their own files and load them into a static object at runtime. It's much easier to maintain than a single file with hundreds of functions in it.
Awesome explanation!
👍
Can't believe you don't have more views! I've learned more, more quickly and intuitively, than any other tuts.
Thank you :) with time they’ll come.
You don't know how much I appreciate for this series. Your contents are really helpful for beginners like me and at the same time also entertaining. Thanks brother. Salute 🫡.
Very glad to hear it. Thank you.
Adorable and useful!!! Thank you!
I am pretty sure that a 30 year old Eugene Levy just taught me about Factory Functions, and I appreciate that.
Haha more like 36 but I'll take it. And thanks for the sub.
What a video bro, what a quality production!!! One more subscriber! Keep up the good work! Thank you very much!
Glad you liked it. Thanks for the sub.
the editing skills and tutorial is superb new subscriber here.. love the camera transition from full to little circle,
Thanks Bryan!
this is my first video here and I can firmly say that this guy is worth a subscribe
I appreciate it!
Excellent video as always bro! I request you to please make a video series on Design Patterns.
Thanks. Will add it to my backlog.
This video is awesome. Thank you so much!
You're welcome
Sina, YOU'RE AMAZING........ I didn't comment on RUclips videos, but YOUR CONTENT forced me to comment, and APPRECIATE YOUR EFFORTS.
I REALLY LOVE your explanation and GRAPHICS.
LOOKING FORWARD TO MUCH MORE FROM YOU :)
THANKS
I appreciate that 🙏
Just found this channel it's amazing great work
Thanks
You are freaking delightful. That is all.
Made my day 🙏
Hey, Thanks for covering factory function, it is very very useful in many many scenarios.
You’re welcome
Extremely helpful -- thank you!
👍
for the first minute of this video i knew that i'm gonna subscribe and like this video
That's awesome! Thank you :)
Great stuff. Liking your videos. I would caution you against writing static functions that assume a context. In this case you assume thw document object which you are using by interracting with you outter scope. This means your function cannot add elements to other scopes. What you should do is introduce an element object and act on it instead of document and document body. The dom heirarchy should be the context in this case
Awesome video!!
Very good teaching, subject very well explained!
The Education needs you man! Keep On ...👌🏽خیلی کارت درسته
Merci ♥️
Thanks for sharing your knowledge with fun and joy❤❤❤
🙏
your video is great, i watched alot of tuts and i didn't get it, but now i understand everything
I'm glad
Thanks for the tutorial. Your way of teaching is simple, easy to understand, and engaging. You've earned a sub. Keep it up!
Thank you
I am so glad I came across your channel. You make learning Javascript fun and you're super funny lol. Thanks a lot!
Happy to hear that!
Great video. Superb production. Helpful explanations.
Thanks!
just found your channel...so proud to learn first 3 videos...(falling for let's shrink whoop ) LOVE FROM INDIA💖
Shhhhhhrink!
@@ColorCode-io you read !! Thanks man😭❤️
Awesome video! Learning about factory functions in my bootcamp right now and this really helped me better understand! The effects and music are high quality, and you break it down so well!🤓 I also really love when code content creators don't edit out their mistakes. It really helps to see possible bugs and fixes! And also encouraging to see people at this level are still human too 😅 Subscribed! Cheers!
Definitely 🙏
Just want to add a thing. I belong to the old school where we were taught to keep an eye on your code's memory requirements. Duplicating code means more RAM is needed. This may not have a major effect on the front end, but on the back end, more RAM for the script can be an issue.
Subscribed after the initial factory animation. Cool video ! 😀
Nice! :)
Learning from you is fun, Thank you
♥️
Amazing Editing. Thanks for the content.
You’re welcome
Absolutely loved the way you explain this type of functions, but I don't get why factory functions shouldn't be creating elements inside the DOM ?
so what is the diffrent between function factory and class?
Thanks man, honestly this has been the best « under the hood » series I have found so far, keep going 🔥
Happy to hear that!
love the way you teach and explain the logic step by step!!!!! You should also do react series too!
I'm considering doing a react course. Thanks!
I have seen many tutorials but this one was the most definitive of them all. Great work brother! Would you suggest learning only classes or factory functions or is it necessary to learn both? For simplicity purposes could we just get familiar with one?
Modern JavaScript patterns are moving more toward functional programming and away from Classes. With that said I think any JS developer should have an understanding of both. They're not that difficult to learn.
@@ColorCode-io Alright.... Right now I'm trying to code a factory function that returns an object which is basically a button with a dropdown list when hovered over. Let's see how it goes!
Great content. Keep uploading more❤
That's the plan!
Thanks!
Really well done stuff!
Appreciate it
Thanks for the Tutorial!
You’re welcome
Hi! I absolutely love your videos, they are extremely helpful in understanding such complex topic. Only one thing - the background music is either distracting (I have ADHD, so it already takes a huge effort to concentrate as it is), or way too soothing (literally makes me super sleepy even after a full night's sleep). Other than the background noise, I am very thankful that you created this series!
Great tutorial! Greetings from brazil
Thank you! Cheers!
Great explanation💯
sir, please create a playlist for javascript. It will help every student who is learning javascript. your teaching method is very easy and gorgeous. thank you.
ruclips.net/p/PL1PqvM2UQiMoGNTaxFMSK2cih633lpFKP
thanks for the tips. good stuff
bro i liked the video at the drop just for that.
Hah thanks!
amazing like always!
🙏
Amazing content.. Just the best
your videos are awesome my friend... thanks for sharing!!
👍👍
great content Sina, thanks
Awesome video brooo completely loved this video.......
Glad you liked it
love your videos man! soo, soo awesome ! do you think, you can briefly describe when to use factory functions and when class?
its really confusing me, because to me, factory functions seem to be much easier to use
I touch on that in this video: ruclips.net/video/fbuyliXlDGI/видео.html
Bro Awesome Video. Enlightened.
1 question - What's the difference between Class and Factory function, other than the OOPS concepts? I mean like memory usage, processing speed, etc
Could you please make a video explaining the event loop?
Looking forward for you to do a video about react native
Soon!
GREAT TUTORIAL!
Thanks :)
bavar nmishe to irani damet garm🔥
Bro just started a new javaScript framework 😁
You're great! Thanks by Brazil
Thank you too!
i can't thank you enough! thanks a lot
Glad it helped!
فوق العاده ای تو پسر
👊🏼👊🏼♥️
How do you clear the console of all previously declared variables / classes / functions?
Refresh
please make all about coding javascipt
Thanks man
🙏
Can you explain how the prototype chain be created by using thhe factory functions like wr can by using the constructor functions?
is that the browser console your using??? or an extension for the browser?
Chrome DevTools console
Great video, hoping for more great vids in the future :)
Yep! More coming end of July
hi ... is this considered learning react also ? (is this useful for react js too?).....
Yes, definitely
Love your videos. At around 9:00 you state that now using the factory function the Object's name can't be changed. It wasn't demonstrated there so it's a bit confusing.
editing is good
Thank you
Thank you.
Does this only work because of how closures work? me.name isn't actually a property so it can't be returned, because at time of object instantiation the closure referenced the passed in name and it (still don't know how it tracks this in memory) knows / has knowledge of what name it was given, but has no actual name property?
Can you do another vid highlighting using private variables in factory functions?
Can you also give a real world example which can be applicable in backend??
These are all design patterns agnostic to frontend or backend. It’s just a way of organizing code so you can def use most of the stuff I teach on backend. The only thing you can’t use it the DOM API which I sometimes use to provide examples.
1:06 Not sure what *Craig* did, but that call-out felt personal 😂
It's a personal hang up of mine. Not fair to Craig.
Thanks
👍🏼
thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You're welcome!
Buddy, you have made a very good presentation. Even though the factory function can return h1, I think we can still modify the innertext without using the setText metod by just accessing the property by h1.el.innertext, is not true? For eg, below code snippet,
function personFactory(name, age) {
const person = {
name: name,
age: age
}
return {
person,
setName(name) {
person.name = name;
},
setage(age) {
person.age = age;
}
}
}
const anonymous = personFactory('anonymous', 25);
console.log(anonymous.person);
anonymous.person.name = 'anonymous anonymous';
console.log(anonymous.person);
How do you tackle such situtations?
tell me the name of song that u use at last part of the video