find last added element in array code example
Example 1: how to get last element of array
return array[array.length - 1];
Example 2: how to get last element of an array
import _ from 'lodash';
let array = [ 1, 2, 3 ];
_.last(array); // 3
return array[array.length - 1];
import _ from 'lodash';
let array = [ 1, 2, 3 ];
_.last(array); // 3