Access elements from Array in JavaScript

How to access elements from Array in JavaScript?

Syntax:

array[index];    // where index starts from 0 and that no of element want to access

Ex:

array[] names=[‘Sam’,’John’,’Sachin’];

document.write(names[0]); // result: Sam as it is first element

Leave a Reply