Array#includes()

includes (obj, startAt) Booleanpublic

Inherited from Ember.Enumerable but overwritten in packages/ember-runtime/lib/mixins/array.js:593

Returns true if the passed object can be found in the array. This method is a Polyfill for ES 2016 Array.includes. If no startAt argument is given, the starting location to search is 0. If it's negative, searches from the index of this.length + startAt by asc.

[1, 2, 3].includes(2);     // true
[1, 2, 3].includes(4);     // false
[1, 2, 3].includes(3, 2);  // true
[1, 2, 3].includes(3, 3);  // false
[1, 2, 3].includes(3, -1); // true
[1, 2, 3].includes(1, -1); // false
[1, 2, 3].includes(1, -4); // true
[1, 2, NaN].includes(NaN); // true

Parameters:

obj Object
The object to search for.
startAt Number
optional starting location to search, default 0

Returns:

Boolean
`true` if object is found in the array.
doc_EmberJs
2016-11-30 16:48:34
Comments
Leave a Comment

Please login to continue.