javascript last item in array
var my_array = /* some array here */;
var last_element = my_array[my_array.length - 1];var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
arr.slice(-1)[0]
const lastItem = colors[colors.length - 1]
Also in JavaScript:
- javascript filter and order
- javascript on click radio button get value
- uirouter
- ngingx proxy express get real ip
- Javascript singly linked list
- cadena promesas javascript
- remove space from string javascript
- pass data from child component to parent component react native
- number format reactjs
- how to update react app
- jquery ajax get
- remove in javascript
- js get first element by class
- como criar uam seessão com jsp
- prepend option on 2nd index jquery
- how store array in another array js
- angular vs react
- javascript get query parameter
- javascript object get property or default
- alertify js vue
- javascript write to firebase
- loopback model count
- ip regex
- get localstorage