<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <title>Title</title> <meta charset="UTF-8"> <script src="jquery-3.4.1.js"></script></head><body><script> //1.jquery中的循环,example1 li=[11,22,33,44]; $.each(li,function(a,b){ console.log(a,b);// });// 结果:// 0 11// 1 22// 2 33// 3 44 //2.example2 dic={‘firstname‘:‘Lai‘,‘lastname‘:‘star‘} $.each(dic,function (a,b) { console.log(a,b); }) //结果:// firstname Lai// lastname star</script> </body></html>
原文地址:https://www.cnblogs.com/startl/p/12293536.html
时间: 2024-11-05 16:38:02