0

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The push() Method</h2>

<p>The push() method appends a new element to an array:</p>

<p id="workingcode1"></p>
<p id="workingcode2"></p>

<script>
const hero = ["Antman","Spiderman","superman","Wonderwoman"];
document.getElementById("Workingcode1").innerHTML = hero;
hero.push("Ironman");
document.getElementById("Workingcode2").innerHTML = hero;
</script>

</body>
</html>

OUTPUT
JavaScript Arrays
The push() Method
The push() method appends a new element to an array:

Antman,Spiderman,superman,Wonderwoman

Antman,Spiderman,superman,Wonderwoman,Ironman

Push() method in Javascript
admin Changed status to publish December 19, 2023