Hackforge Academy

Category: javascript

Local Storage

Published on 16 Jul 2026

Explanation

Local Storage stores data permanently in the browser.

Code:

localStorage.setItem('name','John');

Explanation

Stored values can be retrieved using getItem().

Code:

console.log(localStorage.getItem('name'));

Explanation

Session Storage stores data only for the current browser tab.

Code:

sessionStorage.setItem('token','123');

Explanation

Stored data can be removed using removeItem().

Code:

localStorage.removeItem('name');

Explanation

clear() removes all stored values.

Code:

localStorage.clear();

๐Ÿš€ Learn Spring Boot with real-world projects

๐Ÿ’ก Build REST APIs step by step

๐Ÿง  Improve backend development skills

๐ŸŽฏ Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

๐Ÿ

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
โš›๏ธ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
โ˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community