Array in JavaScript

Array is use to store multiple values in a one variable.

    Example 1:

    <script>
    var a = new Array();
    a[0] = 2;
    alert(a[0]);
    </script>

    Example 2:

    <script>
    var b = new Array(78,4,5,3,5,7);
    for(i=0; i < b.length; i++) { alert(b[i]); } </script>

    Example 3:

    <script type=”text/javascript”>
    var ar = new Array(“Ram”,”Deep”,”Ravi”,”Mohit”);
    for (i=0; i

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.