3 ms·
Or you can return an unsigned int which is the highest valid index+1. ['a','b','c'].indexof('b') == 1 // found - return index ['a','b','c'].indexof('w'
by hoosieree 4y ago
Or you can return an unsigned int which is the highest valid index+1.
['a','b','c'].indexof('b') == 1 // found - return index
['a','b','c'].indexof('w') == 3 // not found - return size of array