You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Returns the index of the first element which equals a provided search element.
1619
+
*
1620
+
* ## Notes
1621
+
*
1622
+
* - If unable to find an element which equals a provided search element, the function returns `-1`.
1623
+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last array element, with the last array element corresponding to `fromIndex = -1`.
1624
+
*
1625
+
* @param x - input array
1626
+
* @param searchElement - search element
1627
+
* @param fromIndex - starting index (inclusive)
1628
+
* @param equalNaNs - boolean indicating whether NaNs should be considered equal
1629
+
* @returns index
1630
+
*
1631
+
* @example
1632
+
* var x = [ 1, 2, 3, 4 ];
1633
+
*
1634
+
* var idx = ns.indexOf( x, 2, 0, false );
1635
+
* // returns 1
1636
+
*
1637
+
* @example
1638
+
* var Int32Array = require( '@stdlib/array/int32' );
1639
+
*
1640
+
* var x = new Int32Array( [ 1, 2, 3, 4 ] );
1641
+
*
1642
+
* var idx = ns.indexOf( x, 2, 0, false );
1643
+
* // returns 1
1644
+
*/
1645
+
indexOf: typeofindexOf;
1646
+
1615
1647
/**
1616
1648
* Returns the last element of an array-like object.
1617
1649
*
@@ -1626,6 +1658,37 @@ interface Namespace {
1626
1658
*/
1627
1659
last: typeoflast;
1628
1660
1661
+
/**
1662
+
* Returns the index of the last element which equals a provided search element.
1663
+
*
1664
+
* ## Notes
1665
+
*
1666
+
* - The function scans an input array from the starting index to the beginning of the array (i.e., backward).
1667
+
* - If unable to find an element which equals a provided search element, the function returns `-1`.
1668
+
* - If `fromIndex` is less than zero, the starting index is resolved relative to the last array element, with the last array element corresponding to `fromIndex = -1`.
1669
+
*
1670
+
* @param x - input array
1671
+
* @param searchElement - search element
1672
+
* @param fromIndex - starting index (inclusive)
1673
+
* @param equalNaNs - boolean indicating whether NaNs should be considered equal
1674
+
* @returns index
1675
+
*
1676
+
* @example
1677
+
* var x = [ 1, 2, 3, 4 ];
1678
+
*
1679
+
* var idx = ns.lastIndexOf( x, 2, 3, false );
1680
+
* // returns 1
1681
+
*
1682
+
* @example
1683
+
* var Int32Array = require( '@stdlib/array/int32' );
0 commit comments