您当前的位置: 首页 >  jquery

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

jQuery第九篇 each方法

发布时间:2020-08-03 18:13:59 ,浏览量:0

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script type="text/javascript" src="jquery-1.10.1.min.js"></script> <script> var arr=[1,3,5,7,9]; var obj={0:1,1:3,2:5,3:7,4:9,length:5}; //JS不能遍历伪数组,只能真的数组. arr.forEach(function(value,index) { console.log(index,value); }); /*obj.forEach(function(value,index)
 		{
 			console.log(index,value);
 		});*/ //jQuery的(可以遍历伪数组的,还有真的数组都可以遍历啊) console.log("jQuery下面的"); $.each(arr,function(index,value) { console.log(index,value); }); $.each(obj,function(index,value) { console.log(index,value); }); </script> </body> </html> 
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.3734s