.index(val)

Description

Index is a method that returns the index of a value in an array

Parameters

Index takes the value to search for as a parameter.

Usage On Arrays

arr = ["wow","hello","world"]
// setup the array

log arr.index("hello")
// returns 2
// hello is at index 2

Last updated

Was this helpful?