Course Banner

Array in javascript

An array is a variable that can hold many variables within it. Programmers may have seen arrays in other languages, and they aren't that different in JavaScript.
a) Array is group of elements.
b) Array value is accessed using array index.
c) Array Index always start with 0.
Array Example :
<script type="text/javascript">
var arr = new Array();
arr[0] = "Java";
arr[1] = "C++";
arr[2] = "PHP";
document.write(arr[0] + arr[1] + arr[2]);
// we can access the value using for loop also
for (i=0;i<arr.length;i++){