1 Star 1 Fork 0

ashy/JS4知识点

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ES5中的filter()方法.html 472 Bytes
一键复制 编辑 原始数据 按行查看 历史
ashy 提交于 2021-01-23 14:38 +08:00 . ES5中的filter()方法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ES5中数组filter()方法</title>
</head>
<body>
<script>
// 利用filter遍历出所有偶数
let arr = [56, 15, 48, 3, 7];
let newArr = arr.filter(function (value, index, array) {
return value % 2 === 0;
});
console.log(newArr)
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ashy66/js4-knowledge-points.git
git@gitee.com:ashy66/js4-knowledge-points.git
ashy66
js4-knowledge-points
JS4知识点
master

搜索帮助