Created
June 1, 2012 02:42
-
-
Save naokazuterada/2848246 to your computer and use it in GitHub Desktop.
localStorage の値を削除したいときはremoveItemを使う
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 間違った方法 | |
localStorage.hoge = 'buuu'; | |
localStorage.hoge = null; // 'null' が代入されてしまう | |
localStorage.hoge = undefined; // 'undefined' が代入されてしまう | |
// 正しい方法 | |
localStorage.hoge = 'buuu'; | |
localStorage.removeItem('hoge'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment