var user = {
name : "jack",
showName : function(){
alert(this.name);
}
}
function getClass(arg){
return {}.toString.call(arg).slice(8, -1);
}
var user = {
name : "jack",
showName : function(){
alert(this.name);
}
}
alert(JSON.stringify(user, function(key, value){
if(getClass(value) == "Function"){
return value.toString();
}
});
JSON.stringify(user, (k, v) => v instanceof Function ? v.toString() : v)