The length of an array is found
using the property length
:
let arr = ['a', 'b', 'c'];
console.log(arr.length) // shows 3
If you know the length of an array, you can get its last element:
let arr = ['a', 'b', 'c'];
console.log(arr[arr.length - 1]) // shows 'c'
Create an array with arbitrary elements. Display on the screen the number of elements in this array.
Create an array with arbitrary elements. Display the last element of this array.