Created
January 29, 2019 13:20
-
-
Save jitendra19/19a5a24d573a4beaa35e2c65fec4d7b3 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
"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