diff --git a/packages/ember-runtime/lib/mixins/array.js b/packages/ember-runtime/lib/mixins/array.js index 144d31db4a8..f02dd6d5b73 100644 --- a/packages/ember-runtime/lib/mixins/array.js +++ b/packages/ember-runtime/lib/mixins/array.js @@ -130,11 +130,21 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot }, /** - Returns the index for a particular object in the index. - - @param {Object} object the item to search for - @param {NUmber} startAt optional starting location to search, default 0 - @returns {Number} index of -1 if not found + Returns the index of the given object's first occurrence, + If no startAt argument is given, the starting location to + search is 0. Returns -1 if no match is found. + + @param {Object} object the object to search for + @param {Number} startAt optional starting location to search, default 0 + @returns {Number} index or -1 if not found + + @example + arr = ["a", "b", "c", "d", "a"]; + arr.indexOf("a"); => 0 + arr.indexOf("a", 2); => 4 + arr.indexOf("z"); => -1 + arr.indexOf("b", 3); => -1 + arr.indexOf("a", 100); => -1 */ indexOf: function(object, startAt) { var idx, len = get(this, 'length');