Published
Edited
Feb 27, 2021
Comments locked
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
todos = []
Insert cell
function addTodo(newTodo) {
todos.push(newTodo);
}
Insert cell
function removeTodo(todo) {
todos.splice(todos.indexOf(todo), 1);
}
Insert cell
addTodo({ id: 2, title: "Practice JS", isComplete: false })
Insert cell
removeTodo({ id: 2, title: "Practice JS", isComplete: false })
Insert cell
todos
Insert cell
Insert cell
Insert cell
vowels = ["a", "e", "i", "o", "u"]
Insert cell
// TODO 🔮
Insert cell
{
expect(vowelsCount("abecedario")).toEqual(6);
expect(vowelsCount("aaaa,cccc,bbee,ee")).toEqual(8);
expect(vowelsCount("youtube")).toEqual(4);
}
Insert cell
Insert cell
story =
"Last weekend, I took literally the most beautiful bike ride of my life. The route is called 'The 9W to Nyack' and it actually stretches all the way from Riverside Park in Manhattan to South Nyack, New Jersey. It's really an adventure from beginning to end! It is a 48 mile loop and it basically took me an entire day. I stopped at Riverbank State Park to take some extremely artsy photos. It was a short stop, though, because I had a really long way left to go. After a quick photo op at the very popular Little Red Lighthouse, I began my trek across the George Washington Bridge into New Jersey. The GW is actually very long - 4,760 feet! I was already very tired by the time I got to the other side. An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautiful park along the coast of the Hudson. Something that was very surprising to me was that near the end of the route you actually cross back into New York! At this point, you are very close to the end.";
Insert cell
overusedWords = ["really", "very", "basically"];
Insert cell
unnecessaryWords = ["extremely", "literally", "actually"]
Insert cell
Insert cell
// TODO 🎨
Insert cell
// TODO 🎨
Insert cell
Insert cell
// TODO 🎨
Insert cell
Insert cell
{
expect(overusedWordsLength).toEqual(8);
expect(unnecessaryWordsLength).toEqual(6);
expect(sentecesLength).toEqual(12);
}
Insert cell
Insert cell
Insert cell
// TODO 🌌
Insert cell
// TODO 🌌
Insert cell
Insert cell
// TODO 📗
Insert cell
// TODO 📗
Insert cell
Insert cell
// TODO 💻
Insert cell
// TODO 💻
Insert cell
Insert cell
{
expect(add(2, 4)).toBe(6);
expect(mult(2, 4)).toBe(8);
expect(rest(8, -10)).toEqual(18);
expect(div(8, 4)).toBe(2);
expect(pow(2, 2)).toBe(4);
expect(sqrt(16, 2)).toBe(4);
}
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