<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let arr = [1,11,2,22,5,55,77,69]
//1.声明新空数组
let Newarr = []
//2.遍历数组
for(let i = 0; i < arr.length; i++){
if(arr[i] < 60){
//3.追加新数组内容
Newarr.push(arr[i])
}
}
console.log(Newarr)
</script>
</body>
</html>
12_数组筛选
最新推荐文章于 2024-08-19 15:26:06 发布