var ourArray = [50,40,30];Nota
ourArray[0] = 15; // equals [15,40,30]
array [0]
. Aunque JavaScript puede procesar esto correctamente, esto puede confundir a otros programadores que leen su código.
0
de myArray
a un valor de 45
.
myArray
ahora debería ser [45,64,99].'
testString: 'assert((function(){if(typeof myArray != "undefined" && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})(), "myArray
should now be [45,64,99].");'
- text: Debe utilizar el índice correcto para modificar el valor en myArray
.
testString: 'assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})(), "You should be using correct index to modify the value in myArray
.");'
```