SOURCE

const arr = [1, 2, 3, 4, 5];
function fn(arr){
    const newArr = arr.map(item => {
        if(item > 3) {
            return item;
        } else {
            return null;
        }
    }).filter(e => e)
    console.log(newArr);
}
fn(arr)
console 命令行工具 X clear

                    
>
console