how to access last node of array in js code example
Example 1: javascipt get last element of array
const arr = [1,2,3] ;
console.log(arr[arr.length - 1]);
Example 2: js array last element get
.slice(-1)[0]
const arr = [1,2,3] ;
console.log(arr[arr.length - 1]);
.slice(-1)[0]