sandbox
Sandbox: environment, black box, simulating the real world in a virtual environment, doing experiments, the experimental results are the same as the real world results, but will not affect the real world
var num=10;
console.log(num+10);
//Sandbox - small environment
(function () {
var num = 10;
console.log(num);
})();
//Sandbox - small environment
(function () {
var num = 20;
console.log(num + 10);
}());
There is no interaction inside and outside
var num = 100;
(function () {
var num = 10;
console.log(num);//10
}());
console.log(num);//100