Conditionally Add Properties to an Object in JavaScript or Node.js
You can dynamically compose objects in JavaScript. You may add a property depending on a configuration or not. For example, when creating a database model you may allow users to configure whether to add or skip timestamps like createdOn and updatedOn. Model instances won’t have timestamps if a user …
Continue Reading