Enumerable#lastObject

lastObjectObjectpublic

Defined in packages/ember-runtime/lib/mixins/enumerable.js:177

Helper method returns the last object from a collection. If your enumerable contains only one object, this method should always return that object. If your enumerable is empty, this method should return undefined.

let arr = ['a', 'b', 'c'];
arr.get('lastObject');  // 'c'

let arr = [];
arr.get('lastObject');  // undefined

Returns:

Object
the last object or undefined
doc_EmberJs
2016-11-30 16:51:59
Comments
Leave a Comment

Please login to continue.