Array vs Linked List Implementation of Stacks (in JS)

Let's say I want to make a Stack class in JavaScript. The class will have a push() and a pop() method. I have two options for the underlying data structure I can use: Linked Lists or Arrays.

Using a Linked List I will have O(1) average and worst time complexities.

Using an Array I will have O(1) average and O(n) worst time complexities, since Array.push() and Array.pop() have O(1) amortized time complexities.

While the Array implementation will occasionally encounter an O(n) operation, it will likely be much faster than the Linked List implementation for every other operation as Arrays are far more optimized than Linked Lists.

Is there any other argument to using a Linked List-based implementation of a Stack other than what I have covered?

I can see why Linked Lists are better for Queues (since Array.shift() and Array.unshift() are O(n) operations), but not for Stacks.

Thanks!

• To my knowledge, an array would almost always run much faster (and even for Queues or double-ended queues, you can implement it using an array in a clever & fast way). So I don't think there is any other argument you haven't covered here. Mar 1 at 20:02
• "every other operation as Arrays are far more optimized than Linked Lists": what do you mean ? If you allude to the fact that arrays support random access, this is irrelevant as a queue ADT only needs to support push and pop. I disagree with your "far more" and your "optimized". Can you explain ? Apr 1 at 10:18