How Does Local Storage Explained In 10 min | Javascript Work?

Local storage is like a super strong backpack that your computer uses to remember things when you're not looking.

Imagine you have a toy box at home. Every time you play with your favorite toys, you put them back in the box so they’re ready for next time. Local storage works the same way, it helps your browser save information so it can use it later.

Like a Toy Box for Your Computer

Your computer is like a kid who plays with different toys. When you're using a website, it's like playing with a specific toy. If you leave the website and come back, the computer checks its local storage, that backpack, to see if it saved anything from your last playtime.

Saving Your Progress

Let’s say you’re building a tower with blocks on a website. You might want to save your progress so you don’t have to start all over again. Local storage lets the website remember how tall your tower was, just like your toy box remembers where you left your toys.

You can even put more than one toy in the backpack, or more than one thing in local storage. It’s a handy tool that helps websites keep track of what you’ve done without asking you every time.

Take the quiz →

Examples

  1. Storing a shopping list on your computer so you don't lose it when you close the browser.
  2. Saving your favorite color in a game so it stays even after you log out.
  3. Remembering your username automatically when you return to a website.

Ask a question

See also

Discussion

Recent activity