Contents

Roo

Array.find()

Searches the array for the passed object. If found, it returns its index in the array. Returns Nothing if the object is not in the array. First the method looks to see if the exact object exists in the array (with a memory lookup). If it doesn’t, the method then checks the values of Boolean, Number and Text objects to find a match.

array.find(obj as Object) as (Number or Nothing)

Parameters

  • obj. The object whose index you wish to find

Returns

  • The index of the requested object as a Number or Nothing if the object isn’t found.

Example

var a = ["a", "b", "c", "d"]
a.find("b") # => 1
a.find("e") # => Nothing