Skip to main content
Module

x/structurae/index.ts>SortedArray#rank

Data structures for high-performance JavaScript applications.
Latest
method SortedArray.prototype.rank
import { SortedArray } from "https://deno.land/x/structurae@4.0.1/index.ts";

Returns the rank of an element in the array.

Examples

//=> SortedArray [ 2, 3, 4, 5, 9 ]; SortedArray.rank(1); // => 0 SortedArray.rank(6); // => 4

Parameters

element: ItemType

the element to look for

Returns

number

the rank in the array