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 값 출력됨
'Javascript' 카테고리의 다른 글
JS 요소 생성, 추가, 클래스 변경, 추가 (0) | 2020.08.05 |
---|---|
JS JSON.stringify(), JSON.parse() (0) | 2020.08.05 |
JS classList (0) | 2020.08.04 |
JS event.preventDefault 이벤트 전파 중지 (0) | 2020.08.04 |
JS 이벤트 생성 (0) | 2020.08.04 |