Hello Friends 👋,

Welcome To Infinitbility! ❤️

This tutorial will help you to get the first element of the array, here we will use the basic syntax of the javascript array to get the first value.

Let start today’s tutorial How to get the first element of the array in javascript?

well, javascript stores all their elements index-based, and every time the first element assigns the 0 index.

when we pass on an array, it will return the first element like this arr[0].

Let understand with an example.

var ary = ['first', 'second', 'third', 'fourth', 'fifth'];
alert(ary[0]);  // first

Thanks for reading…