var arr = [18,45,69,22,7,56];//比方说要删除上述数组中所有的奇数arr = arr.filter(function(v){ return v%2==0; //只返回偶数});console.log(arr);//输出结果 18,22,56