Core Docs | Additional Modules Docs

Array.prototype.inject


@Description: Finds the index of the value given within the array. Return the position of the first matching value. Rememeber that array start at 0.
@File: Array/prototype/inject.js
@Author: Paul Visco
@Version: 1.1 11/19/07
@Param: Object/String/Number val The value to inject into the array.
@Return: Integer
@Example:
var myArray = ['zero', 'one', 'two'];
var answer = myArray.inject(1, 'bagel');

//answer is now ['zero', 'bagel', 'one', 'two'];