how to console log the last value of an array code example Example: javascript get last element in an array var last = arr.slice(-1)[0]