What is Illegal Shadowing

biplavmz

biplavmz

Posted on April 30, 2024

What is Illegal Shadowing

It is a Situation where a variable in a inner Scope **(such as Block,Function) **unintentionally Hide a variable for the same name in an outerScope

Example 1 :->
`var x = 10;

function m1(){
console.log(x)
var x = 100;
console.log(x);
}

m1();`

đź’– đź’Ş đź™… đźš©
biplavmz
biplavmz

Posted on April 30, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related