[][src]Function boa::builtins::array::index_of

pub fn index_of(
    this: &Value,
    args: &[Value],
    _: &mut Interpreter
) -> ResultValue

Array.prototype.indexOf ( searchElement[, fromIndex ] )

indexOf compares searchElement to the elements of the array, in ascending order, using the Strict Equality Comparison algorithm, and if found at one or more indices, returns the smallest such index; otherwise, -1 is returned.

The optional second argument fromIndex defaults to 0 (i.e. the whole array is searched). If it is greater than or equal to the length of the array, -1 is returned, i.e. the array will not be searched. If it is negative, it is used as the offset from the end of the array to compute fromIndex. If the computed index is less than 0, the whole array will be searched. https://tc39.es/ecma262/#sec-array.prototype.indexof