Confuso em içar
considere essas duas versões diferentes de içamento ...
mylocation = "dublin"
function outputPosition() {
alert(mylocation);
mylocation = "fingal" ;
alert(mylocation);
}
outputPosition();
Isto produzirá "fingal" e depois "fingal"
mylocation = "dublin"
function outputPosition() {
alert(mylocation);
var mylocation = "fingal" ;
alert(mylocation);
}
outputPosition();
Isto exibirá "undefined" e "fingal"
Por quê