1.

Why is the findIndex() method used? What does it return in case the value is not found?

Answer»

findIndex() METHOD returns the position of the element in any object. In case the element is not found then the method returns -1.
For example:

var index = $scope.objectsList.findIndex(OBJ => obj.DATE =='2021-21-06');

Here, the index of the object where it has the date property value EQUAL to 2021-21-06 is returned.



Discussion

No Comment Found