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
@send external indexOf: (array<'a>, 'a) => int = "indexOf"
231
+
232
+
/**
233
+
`indexOf(array, item)` returns the index of the provided `item` in `array`. Uses [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality) when comparing items.
234
+
235
+
Returns `-1` if the item doesn not exist. Check out `Array.indexOfOpt` for a version that returns `None` instead of `-1` if the item does not exist.
236
+
237
+
See [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) on MDN.
238
+
239
+
## Examples
240
+
```rescript
241
+
Console.log([1, 2]->Array.indexOf(2)) // 1
242
+
Console.log([1, 2]->Array.indexOf(3)) // -1
243
+
Console.log([{"language": "ReScript"}]->Array.indexOf({"language": "ReScript"})) // -1, because of strict equality
244
+
```
245
+
*/
246
+
@send
247
+
external indexOf: (array<'a>, 'a) => int = "indexOf"
248
+
249
+
/**
250
+
`indexOfOpt(array, item)` returns an option of the index of the provided `item` in `array`. Uses [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality) when comparing items.
251
+
252
+
See [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) on MDN.
0 commit comments