* chore(i18n,curriculum): update translations * chore: Italian to italian Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
1.6 KiB
1.6 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
cf1111c1c11feddfaeb8bdef | Modificare i dati dell'array con gli indici | 1 | https://scrimba.com/c/czQM4A8 | 18241 | modify-array-data-with-indexes |
--description--
A differenza delle stringhe, gli elementi degli array sono mutabili e possono essere cambiati liberamente.
Esempio
var ourArray = [50,40,30];
ourArray[0] = 15;
ourArray
ha ora il valore [15, 40, 30]
.
Note: Non ci dovrebbero essere spazi tra il nome dell'array e le parentesi quadre, come in array [0]
. Anche se JavaScript è in grado di elaborarlo correttamente, questo potrebbe confondere altri programmatori che leggessero il tuo codice.
--instructions--
Modificare i dati memorizzati all'indice 0
di myArray
a un valore di 45
.
--hints--
myArray
dovrebbe ora essere [45,64,99]
.
assert(
(function () {
if (
typeof myArray != 'undefined' &&
myArray[0] == 45 &&
myArray[1] == 64 &&
myArray[2] == 99
) {
return true;
} else {
return false;
}
})()
);
Dovresti usare l'indice corretto per modificare il valore in myArray
.
assert(
(function () {
if (code.match(/myArray\[0\]\s*=\s*/g)) {
return true;
} else {
return false;
}
})()
);
--seed--
--after-user-code--
if(typeof myArray !== "undefined"){(function(){return myArray;})();}
--seed-contents--
// Setup
var myArray = [18,64,99];
// Only change code below this line
--solutions--
var myArray = [18,64,99];
myArray[0] = 45;