Articles → JAVASCRIPT → Arrays in JavaScript

Arrays in JavaScript






What are arrays?





Syntax


var array_object = [list of items separated by comma];



Example


<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
        var alphabets = ["A", "B", "C"];
        for (i = 0; i < alphabets.length; i++)
        {
            document.write(alphabets[i]);
        }

    </script>
</head>
<body>
</body>
</html>



Output


Picture showing the output of array in JavaScript

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, September 25, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250