Skip to content

Instantly share code, notes, and snippets.

@VictorMedeiros
Created August 2, 2016 17:36
Show Gist options
  • Save VictorMedeiros/034b8793c464bab1a0f445943c6010e8 to your computer and use it in GitHub Desktop.
Save VictorMedeiros/034b8793c464bab1a0f445943c6010e8 to your computer and use it in GitHub Desktop.
var calculate = {
array: [1, 2, 3],
sum() {
console.log(this === calculate); // => true
return this.array.reduce((result, item) => result + item);
}
};
calculate.sum(); // => 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment