I\'ve created a class and I would like to set some default options for values in case the user does not supply any arguments. I recently went from a constructor that took mu
You actually just need a oneliner:
const defaultUser = { name: "Joe", age: 47 }; module.exports = class User { constructor(options) { Object.assign(this, defaultUser, options) } }