react get all last element of array code example Example: javascript get last element in array this = array[array.length - 1];