check last index of array in node js code example Example: find last element in array nodejs var a = loc_array.slice(-1)[0]