Lodash findIndex not working

That's because findIndex() takes as parameters an array and a predicate, a function that returns a boolean value based on some condition.

Assuming you are searching for needle in haystack, you can achieve what you want with normal JavaScript:

alert(haystack.indexOf(needle));

You can use _.indexOf (from @Juhana):

alert(_.indexOf(haystack, needle))

You can do it with _.findIndex too:

alert(_.findIndex(haystack, function(x) { return x === needle; }));

or:

alert(_.findIndex(haystack, _(needle).isEqual));