Skip to content

Instantly share code, notes, and snippets.

@jennmueng
Last active March 14, 2019 13:51
Show Gist options
  • Save jennmueng/ef1f4a0667036b9ea578665c55fd787f to your computer and use it in GitHub Desktop.
Save jennmueng/ef1f4a0667036b9ea578665c55fd787f to your computer and use it in GitHub Desktop.
const instanceFactory = (x) => {
this.a = 10;
this.b = x * 5;
this.c = () => {
return a + b;
}
}
const instance = new instanceFactory(3);
// basically returns an object with the following values appended to this.
instance.a; // 10
instance.b; // 15
instance.c() // 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment