#teckiajay #ajaybudaniya #javascript
!!! factory function in javascript #57 !!!
Playlist Link - • JavaScript Complete Course Advance Level
In JavaScript, a factory function is a function that returns an object. It's called a factory function because it creates and returns a new object each time it's called, just like a factory creates and produces new products.
What is the difference between constructor function and factory function - A constructor function is another javascript pattern, that is very similar to factory functions. Though, unlike factory functions, constructor functions do not actually return an object. To create different objects with the same properties, we would need to use the keyword "new" and the keyword "this".
Why do factory functions - Factory functions Instead of using the new keyword to create an object, factory functions set up and return the new object when you call the function. They do not use the prototype, which incurs a performance penalty - but as a general rule, this penalty isn't significant unless you're creating thousands of objects.
Website - https://teckiajay.com
Instagram - / teckiajay
Discord Server - / discord
Telegram channel - https://t.me/tecki_ajay
Thanks For Watching !
keep It up !
En esta página del sitio puede ver el video en línea factory function in javascript #57 de Duración hora minuto segunda en buena calidad , que subió el usuario Tecki Ajay 10 febrero 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 15 veces y le gustó 0 a los espectadores. Disfruta viendo!