Skip to content

Instantly share code, notes, and snippets.

@jitendra19
Created January 29, 2019 13:20
Show Gist options
  • Save jitendra19/19a5a24d573a4beaa35e2c65fec4d7b3 to your computer and use it in GitHub Desktop.
Save jitendra19/19a5a24d573a4beaa35e2c65fec4d7b3 to your computer and use it in GitHub Desktop.
"use strict";
var animal = {
kind: "Cow",
which: function () {
console.log(this.kind);
}
};
var animalFunc = animal.which;
animalFunc();
// error kind of undefined, because of use strict.
----------------------------------------------------------
var animal = {
kind: "Cow",
which: function () {
console.log(this.kind);
}
};
var animalFunc = animal.which;
animalFunc();
// undefined as window object does not contain kind variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment