<script>
var arr = [1500, 1200, 2000, 2100, 1800];
var a = [];
for (var i = 0; i < arr.length; i++) {
if (arr[i] < 2000) {
// a[a.length] = arr[i];
a.push(arr[i]);
// 把arr[i]小于2000的数添加给新数组a
}
}
console.log(a);
console.log(arr);
</script>