Created
August 2, 2016 17:36
-
-
Save VictorMedeiros/034b8793c464bab1a0f445943c6010e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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