<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The splice() Method</h2>
<p>The splice() methods can be used to remove array elements:</p>
<p id="workingdemo1"></p>
<p id="workingdemo2"></p>
<script>
const hero = ["Antman","Spiderman","superman","Wonderwoman"];
document.getElementById("workingdemo1").innerHTML = hero;
hero.splice(0, 1);
document.getElementById("workingdemo2").innerHTML = hero;
</script>
</body>
</html>
Output
JavaScript Arrays
The splice() Method
The splice() methods can be used to remove array elements:
Antman,Spiderman,superman,Wonderwoman
Spiderman,superman,Wonderwoman
Use of splice method() in javascript
admin Changed status to publish December 19, 2023