• 2023-06-25array的reduce
       ES5(js1.8)加入了reduce   接收一个函数,然后从左到右遍历item,直到reduce到一个值。 arr.reduce(callback,[initialValue]);   参数: callback(previousValue,currentValue,index,array)previousValue 如果指定了initialValue,那就用initialValue或
  • 2022-12-23数组方法
    数组方法数组方法1、forEach()2、map()3、filter()4、every()、some()5、reduce()总结 1、forEach()Javascript数组forEach()方法为数组中的每个元素调用一个函数。le
  • 2022-08-19js数组去重
    reduce方案letmyArray=['a','b','a','b','c','e','e','c','d','d','d','d']letmyArrayWithNoDuplicates=myArray.reduce(func