array in JavaScript

In JavaScript, arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. Neither the length of a JavaScript array nor the types of its elements are fixed.
You can define arrays using the array literal as follows,
```
var x = [];
var y = [1, 2, 3, 4, 5];
```
In JavaScript, accessing a non-existent array index does not throw an error - the value "accessed" will simply be undefined
```
var x = [];
var y = [1, 2];
y[5] = 6;
for (var i=0; i<y.length; i++) { 
    print(y[i]); 
}
/*
1
2
undefined
undefined
undefined
6
*/
```