local
tiene prioridad sobre la variable global
. En este ejemplo: var someVar = "Hat";La función
función myFun () {
var someVar = "Head";
devuelve someVar;
}
myFun
devolverá "Head"
porque la versión local
de la variable está presente. myOutfit
para anular el valor de outerWear
con "sweater"
. outerWear
global
testString: 'assert(outerWear === "T-Shirt", "Do not change the value of the global outerWear
");'
- text: myOutfit
debe devolver "sweater"
testString: 'assert(myOutfit() === "sweater", "myOutfit
should return "sweater"
");'
- text: No cambie la declaración de devolución
testString: 'assert(/return outerWear/.test(code), "Do not change the return statement");'
```