Javascript

JS local storage

xxoyeong 2020. 8. 4. 23:22

localStorage.setItem : 데이터 저장

ex) test란 이름의 key값을 정하고 이에 123이란 값을 저장

localStorage.getItem : 데이터 불러오기

local storage : 작은 정보를 유저 컴퓨터에 저장하는 방법

ex)

console 창에

localStorage.setItem("soyeong",true);

하면

 

Application> storage에

key 

soyeong 

value 

true 

들어간걸 볼 수 있음.

 

다시한번 console 창에 

localStorage.getItem("soyeong")

하면 ture 값 출력됨