.index(val)
Description
Index returns the position of a value inside of its input
Parameters
Index takes only one parameter, and will treat multiple parameters as one parameter
Usage On Arrays
log [1,2,3,"hello",5,6].index("hello")
// 4
// you can also just use an attribute getter to find the index
log [1,2,3,"hello",5,6].hello
// 4
Usage On Strings
log "hello world".index("l")
// 3
// it find the first index of the letter and then returns
Last updated
Was this helpful?