Skip to content

Instantly share code, notes, and snippets.

Avatar

Vinay Kumar Vinay18jan

View GitHub Profile
View block_scope.js
function fun(p1) {
console.log(v1);
if(p1){
let v1 = p1;
}
console.log(v1);
{
let v2 = p1 + '_v2';
}
console.log(v2);
View block_scopees5.js
var foo = "foo";
(function() {
var foo = "foo2";
console.log(foo); //OUTPUT foo2
})();
console.log(foo); //OUTPUT foo
@Vinay18jan
Vinay18jan / local.js
Created Jun 29, 2020
Local scope example
View local.js
var foo = "bar";
function bar() {
var foo = "baz";
function baz(foo) {
foo = "bam";
bam = "yay";
}
baz();
}
bar();