应该是没有get到题目的意思……
别人的代码
function bouncer(arr) {
// Don't show a false ID to this bouncer.
return arr.filter(isTrue);
}
function isTrue(ele){
if( ele ){
return ele;
}
}
bouncer([7, "ate", "", false, 9])
function isjia(b) {
var x = Boolean(b)
return x;
}
function bouncer(arr) {
// Don’t show a false ID to this bouncer.
var filtered = arr.filter(isjia);
return filtered;
}
bouncer([7, “ate”, “”, false, 9]);
function bouncer(arr) {
// 请把你的代码写在这里
for(var i=0;i<arr.length;i++){
arr.filter(arr[i]=false||arr[i]=null||arr[i]=0||arr[i]=undifined||arr[i]=NaN||arr[i]="");
return arr;
}
}
bouncer([7, "ate", "", false, 9]);