Login not working as expected . Can someone please check what might be the problem

https://codepen.io/Gautham-Nemuturi/pen/xxNzzqR. Here is the codepen.

only when username is found it should return key else it should return key not found but login returns undefined.

Double check which function contains the return statement

Could you please elboarate.

your login function does not have a return statement so it will always return undefined. The filter callback has a return.

I also don’t understand your use of filter, what are you doing with that?

I want filter based on login . If the username is already present in facebookUsers array. It should return login succesfull else it should return user not found . Try to login. Is there an other way you would suggest doing the login function.

filter returns a new array, please review how filter works, it is not the correct choice here

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.