How to get first element of array in Javascript?

By Hardik Savani | April 18, 2016 | | 636 Viewer | Category : Javascript jQuery


Share this post:

Whenever you require to get first element value then you can use bellow example. I give you the way to get first element value in jquery. So let's see following example:

Example

<script type="text/javascript">


var languages = ["PHP", ".Net", "Java", "Javascript"];


var first_element = languages[0];

console.log(first_element);


</script>