Last active
November 22, 2016 07:11
-
-
Save alili/711a04e9b75ed30b66ef075d33e2f9c0 to your computer and use it in GitHub Desktop.
get properties and methods of an Object
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
function fun(name, age){ | |
this.name = name || 'wonderful' | |
this.age = age || 18 | |
} | |
fun.prototype.getName = function(){ | |
return this.name | |
} | |
var me = new fun() | |
function getDetail(){ | |
return { | |
properties:Object.getOwnPropertyNames(me), | |
methods:Object.getOwnPropertyNames(Object.getPrototypeOf(me)) | |
} | |
} | |
console.log(getDetail(me)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment