Skip to content

Instantly share code, notes, and snippets.

@jhjguxin
Created June 4, 2012 05:18
Show Gist options
  • Save jhjguxin/2866499 to your computer and use it in GitHub Desktop.
Save jhjguxin/2866499 to your computer and use it in GitHub Desktop.
javascript return the method or value of Object
function po(obj, property, func) {
// eval(obj.functionname);
var str = '';
for (prop in obj) {
if (typeof(obj[prop]) != 'function') {
if (property != false) {
str += prop + ':' + obj[prop] + '\n';
}
} else if (func != false) {
str += prop + ':' + typeof(obj[prop]) + '\n';
}
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment