Answers for "get last element of array typesciprt"

28

js get last element of array

const array = ["foo", "bar", "fizz", "buzz"];
const lastElem = array.at(-1); // returns "buzz"
Posted by: Guest on March-17-2022

Code answers related to "get last element of array typesciprt"

Code answers related to "Javascript"

Browse Popular Code Answers by Language