Skip to content

Instantly share code, notes, and snippets.

@jordanhudgens
Created March 17, 2018 04:21
Show Gist options
  • Save jordanhudgens/9d0206a148e21f2e7fc0db14301b44b4 to your computer and use it in GitHub Desktop.
Save jordanhudgens/9d0206a148e21f2e7fc0db14301b44b4 to your computer and use it in GitHub Desktop.
class DecoratedClass {
constructor(arr) {
this.arr = arr;
this.total = 0;
}
sum() {
this.arr.map(el => { this.total += el })
return this.total;
}
}
const arr = [1, 2, 3];
dc = new DecoratedClass(arr);
dc.arr;
dc.sum();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment