js中遍历对象和数组的常用方法
2021-01-16 07:12
标签:index 大于 nts function bsp cti code asc alt 1、对象 for(var 键名 in 对象) 例: js中遍历对象和数组的常用方法 标签:index 大于 nts function bsp cti code asc alt 原文地址:https://www.cnblogs.com/yzkddhxb/p/12927196.html// 筛选出大于3的数
[2, 3, 4, 5,10].filter(function(val, index) {
return val > 3; //[4,5]
})// 筛选出能整除5的数[2, 3, 4, 5,10].filter(function(val, index) {
return val % 5 == 0; //[5,10]
})
下一篇:Python3编码规范