Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Storage as strings

  • localStorage.setItem
  • localStorage.getItem
  • localStorage.removeItem

Values are stored as strings so on retrieval you’ll need to use functions

<!DOCTYPE html>
<html lang="en">
<head><title>String</title></head>
<body>
<script>
var a = 23;
var b = 19;
console.log(a+b);
localStorage.setItem('a', a);
console.log(localStorage.getItem('a') + b);
</script>

</body>
</html>