get the last item array jquery code example Example 1: javascript last element of array arr.slice(-1)[0] Example 2: javascript get last element of array console.log(2)