"HTML5 로컬스토리지 딕셔너리 저장·인출"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
;HTML5 로컬스토리지 딕셔너리 저장
;HTML5 로컬스토리지 딕셔너리 저장·인출
 
==방법==
*[[JSON.stringify]]하여 저장
*인출 후 [[JSON.parse]]하여 사용


==예시==
==예시==

2015년 1월 15일 (목) 00:41 판

HTML5 로컬스토리지 딕셔너리 저장·인출

1 방법

2 예시

<script>
var dict1 = {'foo':'hello', 'bar':'world'};
localStorage.my_dictionary = JSON.stringify(dict1);

var dict2 = JSON.parse(localStorage.my_dictionary);
console.log( dict2 );
// Object {foo: "hello", bar: "world"}
console.log( dict2['foo']);
// hello
</script>

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}