JavaScript push() Function Example

JavaScript Push() function add new element into array string.

Example

<html>
<head>
    <title>JavaScript Array push() function</title>
</head>
<body>
    <script type="text/javascript">
        var city = ["Tokyo", "Mumbai", "Delhi", "Las Vegas"];
        document.write("Amazing Cities: " + city.join(" , ") + "<br />");
        document.write("Length: " + city.push("Milan", "London") + "<br />");
        document.write(city);
    </script>
</body>
</html>

Run it...   »

Example Result