+ 1
Please guys how can i remove a selected item from an array in Javascript?
4 odpowiedzi
+ 3
Hachisenju
if you know the item index you could use splice() method:
array.splice(index,1)
splice take at least 2 arguments (start index, number of items to remove) and can get any number of items to be inserted at start index...
splice also return a new array with removed items ;)
+ 2
https://programacion.net/articulo/como_borrar_valores_de_un_array_con_javascript_1120#:~:text=La%20forma%20correcta%20de%20eliminar,tomando%20como%20partida%20ese%20%C3%ADndice.&text=No%20confundas%20esta%20funci%C3%B3n%20con,un%20sector%20de%20un%20array.
I also recommend reading:
https://developer.mozilla.org/es/docs/Web/JavaScript/Memory_Management
It's all about memory management in JavaScript
+ 2
Thanks all guys