Summary
Finds the starting index of an element.
Description
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
Route
No Northbound API Available
Roles
Parameters
DetailsExampleSchema
| Name |
Type |
Required |
Description |
| arr |
array |
yes |
The array to search |
| searchElement |
* |
yes |
The element to search for |
| fromIndex |
number |
no |
The index to start the search at |
Copied to Clipboard
{
"arr": [
"a",
"b",
"c"
],
"searchElement": "b",
"fromIndex": 1
}
Copied to Clipboard
{
"type": "object",
"properties": {
"arr": {
"title": "arr",
"type": "array",
"items": [
{
"type": [
"string",
"number",
"integer",
"object",
"array",
"boolean",
"null"
]
}
],
"examples": [
[
"a",
"b",
"c"
]
]
},
"searchElement": {
"type": [
"array",
"string",
"boolean",
"integer",
"number",
"object"
],
"title": "searchElement",
"examples": [
"b"
]
},
"fromIndex": {
"title": "fromIndex",
"type": "integer",
"examples": [
1
]
}
},
"required": [
"arr",
"searchElement"
],
"additionalProperties": false
}
Return
DetailsExampleSchema
| Name |
Type |
Description |
| index |
number |
The first index of the element in the array; -1 if not found |
Copied to Clipboard
{
"title": "index",
"type": "integer",
"examples": [
1
]
}