DEV Community

Discussion on: WHAT IS THE LOCAL STORAGE? HOW TO USE IT?

Collapse
 
gusutabopb profile image
Gustavo Bezerra

Adding N items would take O(N²) time as you are rewriting the whole array every time there’s an update. Maybe that’s ok for such small app, but isn’t there a more efficient option like storing items across multiple localStorage keys?

Collapse
 
nightcoder profile image
nightcoder

hey Gustavo ! thank you very much for making this great point !!!👍🏾 + motivating me to really start learning about Big O notation asap ! 😉😋