I have an arrangement: [1,2,3,4,5]
and I want to delete a particular element.
I have achieved this, but I suppose there are other simpler ways in javascript to achieve it.
function eliminar(array, elemento) {
var resultado = []
for (var i = 0; i < array.length; i++) {
if (array[i] !== elemento) {
resultado.push(array[i]);
}
}
return resultado;
}
var array = [1,2,3,4,5];
array = eliminar(array, 3);
console.log( array );
What forms does the language provide to do this?