/*
* 遍历指定对象所有属性名称与值、方法与参数
* object 需要遍历的对象
* author: Jet Mah
* website:
*/
function printObjectProperty(object) {
// 用来保存所有的属性名称和值
var functionArray = "";
var propertyArray = "";
// 开始遍历
var functionIndex = 0; // 方法序号
var propertyIndex = 0; // 属性序号
for(var item in object) {
if(typeof(object[item]) == "function") {
functionIndex++;
functionArray += functionIndex + ":" + item + "=" + object[item] + "\r\n";
}else{
propertyIndex ++;
propertyArray += propertyIndex + ":" + item + "=" + object[item] + "\r\n";
}
}
//浏览器 - F12[调试模式]/Console[控制台]日志输出
console.log(propertyArray)
console.log(functionArray)
// 弹框显示
// alert(props);
// alert(funcs);
}