react get all last element of arrays code example Example: javascipt get last element of array const arr = [1,2,3] ; console.log(arr[arr.length - 1]);