javascript taken the last array code example Example 1: javascript last element of array arr.slice(-1)[0] Example 2: last element of array javascript last element of array