Published
Edited
Feb 18, 2020
2 forks
1 star
Insert cell
Insert cell
Insert cell
Insert cell
{
var something;
//I'm the global scope
if (something) {
//Im in a block scope
}
var obj = {
//I'm also in a block scope
func() {
//Any function scope is also a block scope
},
attr: {
//hey, I'm in a block scope in a block scope!
}
};
}
Insert cell
Insert cell
Insert cell
{
if(false) //this isn't run... or is it?
{
var bob = 'bob'
}
bob = 'joe' //this should not work because var bob should never be declared
return bob;
}
Insert cell
Insert cell
{
var insecureUserIsLoggedIn = false;
var insecureUserIsLoggedIn = true;
return insecureUserIsLoggedIn
}
Insert cell
Insert cell
Insert cell
{
if(false) {
let bob = 'bob'
}
bob='joe'
return bob
}
Insert cell
{
let bob = 'bob'
let bob = 'joe'
return bob
}
Insert cell
Insert cell
{
const str = 'constant'
str = 'bob'
return str
}
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