Last active
February 26, 2018 01:47
-
-
Save cmcdevitt/ac69498aa5bd2438f3bec0729b9902c6 to your computer and use it in GitHub Desktop.
Explore Global Object or Explore Object to see its methods and properties
This file contains hidden or 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
| // "this" is bound to the global object in the browser | |
| // If strict is used then "this" is undefined | |
| //let myObject = this; //Of course you can look at any object | |
| //var myObject = this; | |
| var myObject = { one: "One", | |
| two: function(){return "Hello";}}; | |
| for(objExplore in myObject){ | |
| if(!objExplore.hasOwnProperty(objExplore)){ //note: "Don't searching Prototype Chain" | |
| console.log(objExplore + " " + typeof(myObject[objExplore]) ); | |
| } | |
| } | |
| /* | |
| for(objExplore in myObject){ | |
| console.log(objExplore + " " + typeof(myObject[objExplore])); | |
| } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment