Time complexity of unshift() vs. push() in Javascript

前端 未结 5 910
时光取名叫无心
时光取名叫无心 2020-12-04 17:23

I know what is the difference between unshift() and push() methods in JavaScript, but I\'m wondering what is the difference in time complexity?

5条回答
  •  猫巷女王i
    2020-12-04 18:10

    imho it depends on the javascript-engine... if it will use a linked list, unshift should be quite cheap...

提交回复
热议问题