1.效果图

2.HTML代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>73 使用$.each()工具函数遍历数组</title>
<style type="text/css">
body{font-size: 13px;}
ul{
padding: 0px;
margin: 20px;
list-style-type: none;
width: 260px;
border-top: dashed 1px #ccc;
border-left: dashed 1px #ccc;
border-right: dashed 1px #ccc;
}
ul li{
border-bottom: dashed 1px #ccc;
padding: 8px;
}
.title{
background-color: #eee;
font-weight: bold;
}
</style>
</head>
<body>
<ul>
</ul>
<script src="../jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var arrStu = {"大都督:": "60", "大都督1:": "70", "大都督2:": "80"};
var strContent = '<li class="title">姓名:分数</li>';
$.each(arrStu, function(name, value) {
strContent += '<li>'+name+value+'</li>';
})
$("ul").append(strContent);
var arrStu2 = ["a","b","c","d"];
$.each(arrStu2, function(x, y) {
console.log("arrStu2["+x+"]:"+y);
$("ul").append('<li>arrStu2['+x+']:'+y+'</li>');
})
})
</script>
</body>
</html>