Skip to content

Instantly share code, notes, and snippets.

@VictorMedeiros
Last active August 2, 2016 16:45
Show Gist options
  • Save VictorMedeiros/18746a9a505dceb1e07fde25f7bfb29a to your computer and use it in GitHub Desktop.
Save VictorMedeiros/18746a9a505dceb1e07fde25f7bfb29a to your computer and use it in GitHub Desktop.
var calculate = {
array: [1, 2, 3],
sum: () => {
console.log(this === window); // => true
return this.array.reduce((result, item) => result + item);
}
};
console.log(this === window); // => true
// Throws "TypeError: Cannot read property 'reduce' of undefined"
calculate.sum();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment