Skip to content

Instantly share code, notes, and snippets.

@krfong916
Created November 30, 2018 05:39
Show Gist options
  • Select an option

  • Save krfong916/9e4c6fc49f421b66e0ada8b91485fb2e to your computer and use it in GitHub Desktop.

Select an option

Save krfong916/9e4c6fc49f421b66e0ada8b91485fb2e to your computer and use it in GitHub Desktop.
Ways not to instantiate an object
function sideEffects() {
console.log("this will have a side effect because thats how the object prototype mechanism just works");
}
function Bar () {
console.log(`hey no side effects, we're all good!`);
}
Bar.prototype = new sideEffects();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment