Published
Edited
Dec 9, 2020
Insert cell
Insert cell
Insert cell
{
const mostOuterVariable = 'galaxy'

const outerFunction = () => {
const outerVariable = 'milky way'

const innerFunction = () => {
const innerVariable = 'earth'

return ({
innerVariable, // earth
outerVariable, // milky way
mostOuterVariable, // galaxy
})
}

return innerFunction
}

return outerFunction()()
}
Insert cell
Insert cell
{
const firstScope = () => {
const galaxy = 'milky way'

const getGalaxy = () => galaxy

return getGalaxy
}

const secondScope = () => {
const galaxy = "another galaxy"

const getGalaxy = firstScope()

return(getGalaxy()) // milky way
}

return secondScope()
}
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