Array operation

前端之家收集整理的这篇文章主要介绍了Array operation前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

push and pop are more efficient than shift and unshift

since shift and unshift need to re-index

push O(1)
pop O(1)
shift O(N)
unshift O(N)
concat O(N)
slice O(N)
splice O(N)
sort O(NlogN)
forEach/map/filter/reduce... O(N)

原文链接:https://www.f2er.com/note/411475.html

猜你在找的程序笔记相关文章