the array is a single variable that is used to store different elements. It is often used when we want to store a list of elements and access them by a single variable. the array is a reference to the multiple variables, in JavaScript array is a single variable that stores multiple elements.
syntax
var arrayname=[value1,value2.....valueN];
example
<!DOCTYPE html>
<html>
<head>
<title> alert in javascript</title>
</head>
<body>
<script>
var array=["shivam",
"ravi",
"abhiprit",
"omprakash",
"khushbu",
"nil"];
for(var a=0; a<6; a++)
{
document.write(array[a] + "<br>");
}
</script>
</body>
</html>
output
shivam
ravi
abhiprit
omprakash
khushbu
nil