# JavaScript Arrays

In 
Published 2022-12-03

This tutorial explains to you how the arrays are used in JavaScript.

Here is an example of using arrays in JavaScript:

<!DOCTYPE html>
<html>
<head>
 
</head>
<body>
 
    <script type="text/javascript">
        var names  = new Array("John", "Paul", "Helen");
        var names2 = ["John", "Paul", "Helen"];
        var names3 = ["John", 
                      "Paul", 
                      "Helen"];
                       
        alert(names);
        alert(names2);
        alert(names3);
        alert(names3.length);
        alert(names3[1]);
         
        names3.push("Marry");
        alert(names3);
         
        names3.pop();
        alert(names3);
         
        names3.sort();
        alert(names3);
         
        names3.sort().reverse();
        alert(names3);
         
        names3 = names3.concat(names3);
        alert(names3);
 
    </script>
 
</body>
</html>

And here is the result of the JavaScript:

You will see the screen above 3 times. And after that :