PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 25, 2022

[FIXED] What is the difference between module and factory function?

 November 25, 2022     constructor, factory, function, javascript, module     No comments   

Issue

I am struggling with the concept of modules, factory functions, and constructors...

I am the most curious about the difference between module and factory function, and when to use what?


Solution

The main difference between modules and factory functions are simpler than you think.

Modules are just files with blocks of code that you can import/export.

Whereas factory functions are functions that create objects and return them. Also you might find this other stack overflow post that explains constructor functions vs factory functions:

Constructor function vs Factory functions



Answered By - ByteTheBits
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing