Skip to content

Instantly share code, notes, and snippets.

@regepan
Created December 2, 2013 15:38
Show Gist options
  • Save regepan/7751307 to your computer and use it in GitHub Desktop.
Save regepan/7751307 to your computer and use it in GitHub Desktop.
function Rectangle(w, h){
this.width = w;
this.height = h;
}
Rectangle.prototype.area = function(){
return this.width * this.height;
}
var r = new Rectangle();
/**
* プロパティを調べる
*/
// 動かない
for(key in Rectangle){
console.debug(key + ':' + Rectangle[key]);
}
// 動く
for(key in r){
console.debug(key + ':' + r[key]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment