hawtim.github.io icon indicating copy to clipboard operation
hawtim.github.io copied to clipboard

常用的数组方法总结

Open hawtim opened this issue 5 years ago • 1 comments

判断数组类型

  • Object.prototype.toString.call([]) === '[object Array]'
  • Array.isArray

转换类数组

  • Array.from
  • Array.prototype.slice.call(arguments)

数组方法

  • push/pop 为一组

  • shift/unshift 为一组

  • some/every 为一组

  • map/filter 为一组

  • includes/find/findIndex为一组

  • slice/splice为一组

  • concat/join为一组

  • from/isArray 为一组

  • indexOf/lastIndexOf 为一组

  • reduce 单独一组,对数组中每个元素升序执行 reducer 函数,将结果汇总到累加器中最终返回

    • accumulator
    • currentValue
    • currentIndex
    • sourceArray

hawtim avatar Jun 05 '20 13:06 hawtim

Mindmap attachment: image

hawtim avatar Jul 02 '20 15:07 hawtim