JavaScript pop() Function Example

JavaScript pop() Function remove Last element into array string.

Example

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

        document.write(city.pop() + "<br />");
        document.write(city + "<br />");
        document.write(city.pop() + "<br />");
        document.write(city + "<br />");
        document.write(city.pop() + "<br />");

        document.write(city);
    </script>
</body>
</html>

Run it...   »

Example Result