Land of Joe

[JavaScript] localStorage API 본문

🌐 Web/🟡 JavaScript

[JavaScript] localStorage API

Arendt 2023. 5. 7. 20:03

브라우저에 데이터를 저장할 수 있게 하는 기능

 

 

https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage 

 

Window: localStorage property - Web APIs | MDN

The localStorage read-only property of the window interface allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions.

developer.mozilla.org

 

localStorage.setItem(key, value);

localStorage.setItem("myCat", "Tom");

 

localStorage.getItem(key)

=> value 출력

localStorage.removeItem(key)

=> 삭제