Is Splice faster than Shift + Pop? Why?
问题 I've heard from some nonspecific sources that using a combination of shift() and pop() is faster than using splice() . I haven't run a benchmark test yet and will most likely not for a while since I'm out of town, but is this true, and if so, why? 回答1: If you don't need to retain the order of your Array, using .pop() is much, much faster than .splice() . .splice() will remove an element at a given index. What happens then is that every other element in the array after that one will need to