how get last element of the array code example Example: javascript get last element in array var array =[1,2,3,4]; var last= array[array.length-1];