implement last.js to get the last element of an array