local
tem precedência sobre a variável global
. Neste exemplo: var someVar = "Chapéu";A função
function myFun () {
var someVar = "Head";
return someVar;
}
myFun
retornará "Head"
porque a versão local
da variável está presente. myOutfit
para substituir o valor de outerWear
por "sweater"
. outerWear
global
testString: 'assert(outerWear === "T-Shirt", "Do not change the value of the global outerWear
");'
- text: myOutfit
deve retornar "sweater"
testString: 'assert(myOutfit() === "sweater", "myOutfit
should return "sweater"
");'
- text: Não altere a declaração de retorno
testString: 'assert(/return outerWear/.test(code), "Do not change the return statement");'
```