Saving Data — JavaScript typing lesson

Learn to save and retrieve data using localStorage.

What you'll practice

Let's save data right in your browser! `localStorage` lets you store information that stays even if you close the tab.

  • `localStorage.setItem()` takes two strings: a key (like a label) and the value (the data).
  • The key is how you'll find the data later.

Pro Access Required

This is a premium lesson. Upgrade to Pro to unlock this interactive exercise and continue your learning journey.

📜JavaScript

Saving Data

0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
let secret_message = 'you are a coding star';↵
localStorage.setItem('mysecret', secret_message);↵
↵
console.log('message saved');
0 / 126
Press This!
👇
`~
1!
2@
3#
4$
5%
6^
7&
8*
9(
0)
-_
=+
⌫
⇥
Q
W
E
R
T
Y
U
I
O
P
[{
]}
\|
⇪
A
S
D
F
G
H
J
K
L
;:
'"
↵
⇧
Z
X
C
V
B
N
M
,<
.>
/?
⇧
Thumb
Index
Middle
Ring
Pinky