Index
Definition
Shadowing allows a variable to be re-declared in the same scope with the same name
Variable re-declared in a different scope
- when we exit the scope the original variable stay intact
Variable re-declares in the same scope
- The original variable it’s overwritten by the new one
Nota:
We are not mutating the original variable but we a declaaring a new variable we the same name of the old one
Example of re-declaration:
Example of mutation: