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