var ourArray = [50,40,30];Nota
ourArray [0] = 15; // é igual a [15,40,30]
array [0]
. Embora JavaScript seja capaz de processar isso corretamente, isso pode confundir outros programadores lendo seu código. 0
de myArray
para um valor de 45
. myArray
agora deve 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: Você deve estar usando o índice correto para modificar o valor em 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
.");'
```