Junior JavaScript

What is localStorage?

localStorage stores key-value pairs in the browser permanently (until cleared).

Example:

localStorage.setItem("user", "Alice");

console.log(localStorage.getItem("user")); // Alice

More from JavaScript Tutorial

All questions for this course