javascript - Strange behaviour whith shadowing -


although shadowing should never used (or obfuscate) because it's confusing, wanted understand it. , got strange thing :

alert(parseint('123'));//here, expected 123 it's 'overshadowed' function parseint(){return 'overshadowed';} alert(parseint('123'));//here it's 'overshadowed' 

why first alert output 'overshadowed' whereas function not modified yet?

p.s : got inspired variable shadowing in javascript

in javascript, declarations implicitly placed @ beginning of scope ("hoisted"), doesn't matter if parseint() definition @ second, last, or first line.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -