objectAt (idx) *public
Returns the object at the given index. If the given index is negative or is greater or equal than the array length, returns undefined.
This is one of the primitives you must implement to support Ember.Array. If your object supports retrieving the value of an array item using get() (i.e. myArray.get(0)), then you do not need to implement this method yourself.
let arr = ['a', 'b', 'c', 'd']; arr.objectAt(0); // 'a' arr.objectAt(3); // 'd' arr.objectAt(-1); // undefined arr.objectAt(4); // undefined arr.objectAt(5); // undefined
Parameters:
-
idx
Number - The index of the item to return.
Returns:
-
* - item at index or undefined
Please login to continue.