Monday, June 17, 2013

the _.last of underscore.js will get the last item in an array

This...

var foo = _.last(myArray);

 
 

...does the same thing as this...

var foo = myArray[myArray.length - 1];

No comments:

Post a Comment