Array.filter 没有按预期工作,我最后得到的是 Null Array

Array.filter not working as expected, I am getting Null Array in the end

const normArray = [1, 2, 3, 4, 5];           //array

const mapArray = normArray.map((num)=>{ 
  return num * 5;
})                                           //mapping

const filterArray = mapArray.filter((num)=>{ 
  num > 5;
})                                           //filtering


console.log(mapArray);
console.log(filterArray);

输出为 = [5, 10, 15, 20, 25] & [ ] ,为什么过滤数组为空? 和平与祝福降临在你身上:) 谢谢!

您没有在函数参数中返回布尔值。应该是:

const filterArray = mapArray.filter((num)=>{ 
  return num > 5;
});