1
votes

I made a search input by using filter method but there is a warning with this.What was wrong?

Code picture

1
Please add the exact error. Also show what you have tried so far. - Adib Hasib
Your Function provided for the Array.prototype.filter() Method should return a boolean value to if the checked element should be kept or be filtered. There are 2 problems with your Function: 1) it can reach a state, where no boolean value is returned. Just add return false; at the end. 2) You are returning the element although it only wants boolean values. Therefore the function could behave not as you expect. - IISkullsII
@IISkullsII Thanks a lot I fixed it. - ASH tech

1 Answers

0
votes

You have cases in which you don't return anything.

if (conditionA){
    return ...;
} else if (confitionB) {
    return ...;
}
// Nothing gets returned

You should add a return at the end of your function for when coditionA and coditionB are both false