![]() When it does so without the new keyword, it’s a factory function.įactory functions have always been attractive in JavaScript because they offer the ability to easily produce object instances without diving into the complexities of classes and the new keyword. In JavaScript, any function can return an object. There’s a lot more of this to come! Buy the Book | Index | Ī factory function is any function which is not a class or constructor that returns a (presumably new) object. Note: This is part of the “Composing Software” serie s (now a book!) on learning functional programming and compositional software techniques in JavaScript ES6+ from the ground up. Smoke Art Cubes to Smoke - MattysFlicks - (CC BY 2.0)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |