示例代码:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <meta charset="utf-8" /> </head> <body> <script src="Scripts/jquery-1.10.2.js"></script> <script type="text/javascript"> var list = [{ name: "tom", age: 10 }, { name: "li", age: 11 }, { name: "bai", age: 12 }, { name: "zhang", age: 13 }, { name: "ming", age: 14 }]; $.each(list, function (index, item) { if (item.name == "tom") { return true; } console.log(item.name+"======="+item.name); }); </script> </body> </html>
代码经过测试。
原文:https://www.cnblogs.com/Tpf386/p/11417445.html