Get first and last object in JavaScript Array

October 5, 2019

When you are developing JS application using Ract,Angular or Vue, you will need to get the first and last element of the object array.

You can use the following code to get the first element of the array. It is the 0th element of the array


If you want to get the last element of the array you can use the following code