How to check if i have specific value inside my localStorage?

i want to check if the name value i put in the input exists inside my local Storage by the key 'username'. [ just for be clear i make an array that everytime i make a new register it adding the new username to the array and to the localStorage i insert the array ]

It seems like you're not passing user into your function unless it is globally declared somewhere else in your code. You are passing in user.value which is not a valid param name, you will need to pass just user and pass in so an example of how to invoke it would be.

login('fooUser','barPassword');

Email codedump link for How to check if i have specific value inside my localStorage?