阅读背景:

js 的each()方法遍历对象和数组

来源:互联网 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
 <script src="../lib/jquery-1.8.3.min.js" ></script>
<script type="text/javascript" charset="utf-8">

var arr = ["a", "b", "c", "d", "e"];  
var obj = { a: 'one', b: 'two', c: 'three', d: 'four', e: 'five' };

$.each(obj,function(key,value){
	console.log("Obj :" + key + '-' + value);
})


$.each(arr,function(key,value){
	console.log("arr :" + key + '-' + value);
})
</script>
</body>
</html><!DOCTYPE html>
<html>
<head>
<meta charset="UT



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: