I am confused between the difference between the two function indexOf and find Index in an array.
The documentation says
findIndex - Returns
You can also use includes:
includes
[1, 2, 3].includes(2); // true [1, 2, 3].includes(4); // false [1, 2, 3].includes(3, 3); // false
but I prefer the indexOf method:
indexOf
var vals = [ "foo", "bar", 42, "baz" ]; if (~vals.indexOf( 42 )) { // found it! }