Platform
Resources
Pricing
Sign in
Get started
Megan Slusarewicz
Workspace
Fork
Published
By
Megan Slusarewicz
Edited
Mar 1, 2021
Insert cell
Insert cell
Insert cell
Insert cell
display
=
md
`${
textChangedByText
[
0
]
}`
Insert cell
viewof
textInput
=
Text
(
{
label
:
"Type something:"
,
placeholder
:
"Yes, type over me ..."
}
)
Insert cell
{
let
text
=
``
;
if
(
textInput
==
""
)
text
=
textChangedByText
;
else
text
=
getRandomword
(
)
;
display
.
innertext
=
text
;
}
Insert cell
getRandomword
=
function
(
)
{
let
words
=
RiTa
.
tokenize
(
textChangedByText
[
0
]
)
;
let
randword
=
Math
.
random
(
words
.
length
+
1
)
;
words
[
randword
]
=
Text
;
return
RiTa
.
untokenize
(
words
)
;
}
Insert cell
textInput
Insert cell
textChangedByText
=
[
"Hi I'm Megan"
]
Insert cell
RiTa
=
require
(
"rita"
)
Insert cell
RiTa
.
VERSION
Insert cell
Insert cell
whichKey
=
document
.
addEventListener
(
'keypress'
,
e
=>
{
return
e
.
key
;
if
(
e
.
key
==
"Enter"
)
return
"Enter pressed"
;
}
)
Insert cell
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
display
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
textInput
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getRandomword
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
textChangedByText
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
RiTa
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
whichKey
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
report
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML