Answer :

Answer:

In Javascript array are the special type of object ,to store the multiple value in single variable we used array in javascript .

Explanation:

We can create an array in javascript by using following syntax

var arrayname=[value1,value2.........valuen];

For example :

var st=["san","ran",tan"];

In javascript array are treated as object.  

we can declare and initialize an object of array

var st=["san","ran",tan"]; // declaring array  

document.getElementById("d2").innerHTML = st[0]; // accessing the member of array by array object.

In this st object access the first element in the array .

Following are implementation of declare and initialize an object an array

<html>  

<body>  

<p id="d2"></p>  

<script>  

var st=["san","ran",tan"];  

document.getElementById("d2").innerHTML = st[0];  

</script>  

</body>  

</html>  

Output:

san

Other Questions