(5/10)
Loading Data — JavaScript typing lesson
Practice loading and parsing saved data from localStorage.
What you'll practice
Now let's get our saved data back! `localStorage.getItem()` lets you retrieve information using its key.
- `localStorage.getItem()` takes the key (label) of the data you want to retrieve.
- If no data is found for that key, it returns `null`.
Pro Access Required
This is a premium lesson. Upgrade to Pro to unlock this interactive exercise and continue your learning journey.
📜JavaScript
Loading Data
0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
5
6
7
8
let loaded_message = localStorage.getItem('mysecret');↵
↵
if (loaded_message) {↵
console.log('your secret message is');↵
console.log(loaded_message);↵
} else {↵
console.log('no secret message found');↵
}
0 / 208
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
;:
'"
↵
⇧
Z
X
C
V
B
N
M
,<
.>
/?
⇧
Thumb
Index
Middle
Ring
Pinky