Platform
Resources
Pricing
Sign in
Get started
Alok Pepakayala
Data visualization/Interactive media and full-stack data science web app developer.
Workspace
Fork
Published
By
Alok Pepakayala
Edited
May 24, 2020
7 stars
Insert cell
md
`# Persist data of a cell in local storage`
Insert cell
mutable
data
=
{
var
initial
=
JSON
.
parse
(
localStorage
.
getItem
(
"data"
)
||
"[]"
)
;
return
initial
;
}
Insert cell
viewof
click_this
=
{
var
button
=
html
`<button>Add random value to data`
;
button
.
addEventListener
(
'click'
,
(
)
=>
{
mutable
data
=
mutable
data
.
concat
(
[
Math
.
random
(
)
]
)
;
localStorage
.
setItem
(
"data"
,
JSON
.
stringify
(
mutable
data
)
)
;
}
)
;
return
button
;
}
Insert cell
data
.
length
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
click_this
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML