-
Notifications
You must be signed in to change notification settings - Fork 15
JSArray.IndexOf
boxgaming edited this page Jul 25, 2026
·
3 revisions
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
result% = JSArray.IndexOf ( a, searchElement [,fromIndex%] )
- The a parameter contains the native Javascript array on which the operation will be performed.
- The searchElement parameter contains the value used for comparison.
- The optional fromIndex% specifies the 0-based index of the item to retrieve from the array. Negative integers count back from the last item in the array.
Import JSArray From "lib/lang/array.bas"
Dim colors As Object
colors = JSArray.Create("red", "green", "blue", "orange", "yellow", "white")
Print JSArray.IndexOf(colors, "blue")
Print JSArray.IndexOf(colors, "red")2
0
JSArray.Create
JSArray.LastIndexOf
Javascript - Array.indexOf()