firstObjectObject
public
Helper method returns the first object from a collection. This is usually used by bindings and other parts of the framework to extract a single object if the enumerable contains only one item.
If you override this method, you should implement it so that it will always return the same value each time it is called. 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('firstObject'); // 'a' let arr = []; arr.get('firstObject'); // undefined
Returns:
-
Object
- the object or undefined
Please login to continue.