var arr = [2, 0, 6, 1, 77, 0, 52, 0, 25, 7];var newArr = [];for (var i = 0; i <; arr.length; i++) {if (________) {newArr[newArr.length] = arr[i];}}console.log(newArr);补充完整上面的代码,newArr数组中的数据是arr中不包含 0的数据。[/i]
举一反三
- var arr = [2, 0, 6, 1, 77, 0, 52, 0, 25, 7];var newArr = [];var j = 0;for (var i = 0; i <; arr.length; i++) {if (arr[i] >;= 10) {_________________}}console.log(newArr);补充完整代码,运行后newArr数组中存放的是arr数组中所有大于等于10的值。[/i] A: j++;newArr[j] = arr[i]; B: newArr[j] = arr[i];j++; C: arr[i]=newArr[j];j++; D: j++;arr[i]=newArr[j];
- 【单选题】var arr = [2, 0, 6, 1, 77, 0, 52, 0, 25, 7];var newArr = [];for (var i = 0; i <; arr.length; i++) {if (arr[i] >;= 10) {newArr[newArr.length] = arr[i];}}console.log(newArr);运行上面的代码,输出结果是()。[/i][/i] A: 2,0,6,1,0,0,25,7 B: 7,25,0,0,1,6,0,2 C: 77,52,25 D: 25,52,77
- var arr = [];for (var i = 0; i <; 10; i++) {________________;}console.log(arr);补充完整上面代码,使的arr数组中的数据为[1,2,3,4,5,6,7,8,9,10]。
- 智慧职教: var arr = [2,3,4,5,6]; var sum =0; for(var i=1;i < arr.length;i++) { sum +=arr[i] } console.log(sum);[/i]
- 分析下段代码输出结果是_________。 var arr = [2,3,4,5,6]; var sum =0; for(var i=1;i < arr.length;i++) { sum +=arr[i] } console.log(sum);[/i]