Use the push() method to add a new item to array - Javascript Array

Javascript examples for Array:Quiz

Description

Use the push() method to add a new item to array

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var myArray = ["Javascript", "HTML", "CSS"];
myArray.push("SVG");
document.getElementById("demo").innerHTML = myArray;
</script>/* w  w w .ja  v a2s.  c o m*/

</body>
</html>

Related Tutorials