Remove particular element from JavaScript Array
home
Run
screen_rotation
fullscreen
cloud_download
<html> <head> <title>Javascript Demo</title> <script type='text/javascript'> function removeElement(){ var array = [1, 7, 10, 11]; alert('Array Before Delete = '+array); var index = array.indexOf(10); if (index > -1) { array.splice(index, 1); } alert('Array After Delete = '+array); } </script> </head> <body> <a href="javascript:void(0)" onclick=" removeElement()">Click To Remove Element-</a> <p id='result'></p> </body> </html>
<html> <head> <title>Javascript Demo</title> <script type='text/javascript'> function removeElement(){ var array = [1, 7, 10, 11]; alert('Array Before Delete = '+array); var index = array.indexOf(10); if (index > -1) { array.splice(index, 1); } alert('Array After Delete = '+array); } </script> </head> <body> <a href="javascript:void(0)" onclick=" removeElement()">Click To Remove Element-</a> <p id='result'></p> </body> </html>
Copyrights@tutorialsplane.com