javascript last element of an arrat code example Example 1: javascript last element of array arr.slice(-1)[0] Example 2: js array last element get .slice(-1)[0]