When to use a linked list in Javascript?

When to use a linked list in Javascript?
0.0 0


From what I understand, the principal advantage of a linked list over an array has to do with better performance when adding elements in the middle of the list/array. Can anyone give some concrete, practical, examples of when this would be necessary? In what example scenarios would it make more sense to use a linked list instead of an array?


Linked lists are useful if you’re coding in C, C++ etc, but I can’t think of a practical reason of implementing them in JS. The arrays are almost like hash maps anyway, so adding in the middle isn’t an issue. Besides, if you need to write fast running code, you almost never will be using JS.