Published
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.
Learn more