Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Last active February 26, 2018 01:47
Show Gist options
  • Select an option

  • Save cmcdevitt/ac69498aa5bd2438f3bec0729b9902c6 to your computer and use it in GitHub Desktop.

Select an option

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" 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