Skip to main content

indexOf()

indexOf<T>(x): (arr) => number

Returns the first index at which a given element can be found in the array. Returns -1 otherwise.

Type Parameters

T

T

The type of array elements.

Parameters

x

T

The value to find in the array.

Returns

(arr): number

Parameters

arr

T[]

Returns

number

Remarks

pure function

Example

import { indexOf } from '@accelint/core';

indexOf(3)([1, 2, 3, 4, 5]);
// 2