Published
Edited
Mar 20, 2020
Importers
Insert cell
md`# random-id`
Insert cell
allUpperCaseLetters = Array.from({ length: 26 }).map((_, i) =>
String.fromCharCode(i + 65)
)
Insert cell
allLowerCaseLetters = Array.from({ length: 26 }).map((_, i) =>
String.fromCharCode(i + 97)
)
Insert cell
allCaseLetters = [...allUpperCaseLetters, ...allLowerCaseLetters]
Insert cell
getRandomLetter = () => {
const index = Math.floor(Math.random() * allCaseLetters.length);
return allCaseLetters[index];
}
Insert cell
getRandomLetter()
Insert cell
getRandomChunk()
Insert cell
getRandomChunk = () => {
const time = Math.round(new Date().getTime() * Math.random());
return time.toString(32);
}
Insert cell
getRandomId = () =>
getRandomLetter() + getRandomChunk() + getRandomChunk() + getRandomChunk()
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