JavaScript · Senior · Question 41 of 75

Where should you store large structured data on the client (e.g. an offline cache)?

Explanation

localStorage is limited to a few megabytes, stores only strings and blocks the thread. Cookies are small (~4 KB) and are sent with every request. IndexedDB stores objects and Blobs and supports transactions and indexes; it's easier to use via wrappers like idb.

Further reading

Problem with a question

JavaScript · Senior · question 41

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz