map,filter的区别

tech2025-07-22  4

对于过滤数组而言,map返回的是布尔值,filter则是返回满足条件的值。

想改变数组的时候用map,想对数组进行过滤用filter,累加数组用reduce

最新回复(0)