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
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
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more
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 addreturn 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