How to check if I have a 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 to be clear I make an array that every time I make a new register it adding the new username to the array and to the localStorage I insert the array ]