0
JavaScript statement that retrieves the element with the value 43 from the array myNums?
var myNums = [78, 43, 212, 42, 2, 41];
1 Resposta
+ 1
var i = myNums.indexOf(43);
if (i!=-1) var num = myNums.splice(i,1)[0];
// .splice array method return sub array extracted from index as first argument and with length as second one... you could add how many items as optionnal arguments to be inserted in place of removed values...