0 points

Factory Function


dashboard

Tue Sep 08 2020 23:26:02 GMT+0000 (UTC)

Posted by @dgaldon #javascript

function User(name, age) {
  return {
    name,
    age,
  }
};

let user = User("Tom", 23);
content_copy Copy

https://stackoverflow.com/questions/8698726/constructor-function-vs-factory-functions