acess last ele in array in js code example Example 1: javascript last element of array arr.slice(-1)[0] Example 2: last element of array javascript last element of array