Published
Edited
Jul 16, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
var a1,a2,a3,a4,a5;
[a1,a2,a3,a4,a5] = array
return `
a1= ${a1},
a2= ${a2},
a3= ${a3},
a4= ${a4},
a5= ${a5}
`
}
Insert cell
{
var { bob, your, but, is, a } = obj //this is a valid syntax if you don't want to declare the variables separately...
return `
bob= ${bob},
your= ${your}
but= ${but}
is= ${is}
a= ${a}
`
}
Insert cell
Insert cell
{
var bob, rest;
( { bob, ...rest } = obj )
return `Bob: ${bob}, everything else: ${JSON.stringify(rest)}`
}
Insert cell
{ //because strings are just arrays...
var start, rest;
([start, ...rest] = str)
return start + "/" + rest
}
Insert cell
{
var start, rest;
([start, ...rest] = array)
return start + "/" + rest
}
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