+ 1

Please guys how can i remove a selected item from an array in Javascript?

14th Mar 2021, 12:31 AM
Mahdi Attaby Ibrahim
Mahdi Attaby Ibrahim - avatar
3 Respostas
+ 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 ;)
14th Mar 2021, 1:06 AM
visph
visph - avatar
+ 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
14th Mar 2021, 12:53 AM
Daniel Briceño
Daniel Briceño - avatar
+ 2
Thanks all guys
14th Mar 2021, 1:12 AM
Mahdi Attaby Ibrahim
Mahdi Attaby Ibrahim - avatar