![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 //返回一个对象的属性和方法,用于Debug 2 function getMethodAndPropertys(obj) { 3 var result = []; 4 for (var id in obj) { 5 try { 6 if (typeof(obj[id]) == "function") { 7 result.push("function " + id + ": " + obj[id].toString() + "<br /><br />"); 8 } 9 else { 10 result.push("property " + id + ": " + obj[id].toString() + "<br /><br />"); 11 } 12 } catch (err) { 13 result.push(id + ": inaccessible"); 14 } 15 } 16 return result; 17 }