To use the indexOf() function from the Underscore library to search for an element in an array, you can do the following:
index.tsx67 chars2 lines
index.tsx31 chars2 lines
indexOf() function, call it on the Underscore object and pass in the array and the element you want to find as arguments:index.tsx35 chars2 lines
The variable index will now contain the index of the element 3 in the array myArray. If the element is not found, the function will return -1.
gistlibby LogSnag