//uncomment each line one at a time and run, notice the error when you try to REDECLARE using let
letcolor='yellow'
// color = 'green'
// let color = 'white'
returncolor
}
{
//notice how you can't reassign nor redecalre with const?
constcolor='purple';
// color = 'violet';
// const color = 'pink';
returncolor
}
{
constlistOfComputerComp=['apple','dell'];
listOfComputerComp.push('compaq');
// listOfComputerComp = [1, 1];
// listOfComputerComp.pop();
returnlistOfComputerComp;
}
jsFile={
//Global Scope
letmilkyWay='I am globally scoped, so you can access me anywhere!';
{//Block Scope
varearth='Earth';
constsun='Sun';
lethouse='My house';
}
//UNCOMMENT THESE ONE AT A TIME TO SEE WHAT HAPPENS (REMEMBER TO RECOMMENT THE LINE YOU UNCOMMENTED ALREADY)
// return earth;
// return milkyWay
// return house;
returnsun;
}
//
{
returnname;
varname='Beth';
}
//notice that we return name first and it name was assigned as 'undefined'
{
returnname;
letname='Hanayo';
}
//let and const doesn't get referenced in the beginning of the scope, but rather just declared without being assigned to any value
{
returnname;
letname='Tofe';
}
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.