Published
Edited
May 7, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Insert cell
Insert cell
Insert cell
myArray.map((d) => d * 10)
Insert cell
Insert cell
Insert cell
myArray.filter((d) => d < 5)
Insert cell
Insert cell
Insert cell
// ... import the `myDataset` cell from the previous notebook as the 'ages' cell of this notebook
Insert cell
Insert cell
ages
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
viewof table = Inputs.table(ages) // or Inputs.table(ages), or selectedRows.value if you check boxes for some rows and output only the selected values but it shows some weird raw html version of the values . viewof selectedRows = Inputs.table(ages) is better since it is easier for observable and very useful for visualization
Insert cell
Insert cell
Insert cell
ages.map((d) => d.name) //takes the datum and only takes the name
Insert cell
Insert cell
Insert cell
ages.filter((d) => d.name === "Gandalf") //if you did map instead of filter it will just return whether the value is true or false (answer to below line)
Insert cell
// what would happen if you were to use `map()` instead of `filter()`? Try and find out.
Insert cell
Insert cell
Insert cell
ages.filter((d) => d.age > 20_000)
Insert cell
Insert cell
Insert cell
ages.filter((d) => d.age < 1000)
Insert cell
Insert cell
Insert cell
import {imageToDo} from "@clokman/student-blocks"
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