网站地图    收藏   

主页 > 前端 > css教程 >

console.table()调试javascript - html/css语言栏目:html

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] !doctype html html head meta charset=utf-8 head body script ** * * @authors Benjamin * @date 2013-11-18 13:08:18 *...

<!doctype html>  
<html>  
<head>  
    <meta charset="utf-8">  
</head>  
<body>  
<script>  
/**  
 *   
 * @authors Benjamin  
 * @date    2013-11-18 13:08:18  
 * console.table()调试javascript  
 * 直接进入实例  
 */  
//定义一个对象  
var obj = {  
    "name":"张三",  
    "age" :20,  
    "sex" :"male"  
};  
console.log("------obj------");  
console.log("console.log()打印:");  
console.log(obj);  
console.log("console.table打印:");  
console.table(obj);  
  
//定义一个数组  
var arr = ["aa","bb","cc","dd"];  
console.log("------arr------");  
console.log("console.log()打印:");  
console.log(arr);  
console.log("console.table打印:");  
console.table(arr);  
  
//定义一个多维数组  
var arr = ["aa","bb","cc","dd",["ee","ff","gg",["hh","ii"]]];  
console.log("------arr------");  
console.log("console.log()打印:");  
console.log(arr);  
console.log("console.table打印:");  
console.table(arr);  
  
//定义一个对象数组  
var objArr = [{  
    "name":"张三",  
    "age" :20,  
    "sex" :"male"  
},{  
    "name":"张三",  
    "age" :20,  
    "sex" :"male"  
}];  
console.log("------objArr------");  
console.log("console.log()打印:");  
console.log(objArr);  
console.log("console.table打印:");  
console.table(objArr);  
  
//定义一个多级对象数组  
var objGradeArr = [{  
    "name":"张三",  
    "age" :20,  
    "sex" :"male",  
    "attribute":{  
        "a":"aa",  
        "b":"bb",  
        "c":"cc"  
    }  
},{  
    "name":"张三",  
    "age" :20,  
    "sex" :"male",  
    "attribute":{  
        "a":"aa2",  
        "b":"bb2",  
        "c":"cc2"  
    }  
}];  
console.log("------objGradeArr------");  
console.log("console.log()打印:");  
console.log(objGradeArr);  
console.log("console.table打印:");  
console.table(objGradeArr);  
</script>  
</body>  
</html>  

 
调试结果如下图:

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论