js get first element array index 0 code example Example 1: javascript get first element of array console.log(ary[0]); Example 2: javascript get first element of array alert(ary[0])