Published
Edited
Mar 9, 2018
Insert cell
Insert cell
Insert cell
"hello fred"
Insert cell
Insert cell
42
Insert cell
Insert cell
3+4*7
Insert cell
Insert cell
"Hello." + "My name is Quintin."
Insert cell
Insert cell
"hello" - 7
Insert cell
Insert cell
Insert cell
Insert cell
3 > 7
Insert cell
Insert cell
7 > 3
Insert cell
Insert cell
[ 3, 7, 8 ]
Insert cell
Insert cell
Insert cell
Insert cell
Math.sqrt(3.7 * 4 + 3^4 - 7 * Math.sin( 32 ))
Insert cell
Insert cell
myCalc = Math.sqrt(3.7 * 4 + 3^4 - 7 * Math.sin( 32 ))
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
{
let myList = []
myList.push( 3+8*4-7 )
myList.push( 4+8 )
return myList
}
Insert cell
Insert cell
Insert cell
{
let count = 1
let numList = []
count = count + 1
numList.push( count )
count = count + 1
numList.push( count )
count = count + 1
numList.push( count )
return numList
}
Insert cell
Insert cell
Insert cell
{
let count = 1
let numList = []
count++
numList.push( count )
count++
numList.push( count )
count++
numList.push( count )
return numList
}
Insert cell
Insert cell
Insert cell
{
let numList = [];
for( let count=2; count<=4; count++ )
{
numList.push( count )
}
return numList
}
Insert cell
Insert cell
Insert cell
Math.random()
Insert cell
Insert cell
Math.floor( Math.random() * 10 )
Insert cell
Insert cell
function myRandom( upperLimit )
{
return Math.floor( Math.random() * (upperLimit + 1) )
}
Insert cell
Insert cell
myRandom( 100 )
Insert cell
Insert cell
points = {
let myArray = []
for( let count = 0; count < 100; count++ )
{
myArray.push( myRandom( 100 ) )
}
return myArray
}
Insert cell
Insert cell
{
const context = DOM.context2d(width, 10)
context.rect(5,5,1,1)
context.stroke()
return context.canvas
}

Insert cell
Insert cell
{
const context = DOM.context2d(100, 100)
for( let xIndex = 0; xIndex < points.length; xIndex += 2 )
{
context.rect( points[ xIndex ], points[ xIndex + 1 ],1,1)
context.stroke()
}
return context.canvas
}
Insert cell
Insert cell
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