What's missing in this code?
search(['cat1', 'dog2', 'fish10', 'bat3', 'zebra']);
// [ 'cat1', 'dog2', 'bat3' ]
search(['car7', 'bike8', 'plane9', 'train10', 'boat3']);
// [ 'car7' ]
search(['red2', 'blue3', 'green', 'yellow1', 'purple4']);
// [ 'red2' ]
search(['php1', 'john3', 'book4', 'page12', 'pen5']);
// [ 'php1', 'pen5' ]
search(['apple9', 'orange5', 'grape2', 'banana12', 'pear3']);
// []
function search(arr) {
return arr.filter((item) => /
/.test(item));
}
Type or select from these options