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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more