last element in an array using java script

arrayname.slice(-1)[0];

arrayname.slice(-1).pop();