Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics Making Decisions in Your Code with Conditional Statements Introducing Conditional Statements

How would I perform a password check where the importance of case sensitivity can't be ignored by uppercasing everything

If the password is, let's say 5d7988B, with the uppercase method we could also write 5D7988b which would result in a correct password that is actually wrong.

1 Answer

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi Ernest Nezić,

Let me know if I’m not understanding your question correctly, but if case sensitivity is important (as such is with the case of passwords) you simply would not call toUppercase() on the string. You would just compare the user’s input as is against the password stored in the database.

In reality, you would hash the user’s input and compare it against a hashed password within your database, but the point I’m trying to make is that you would not manipulate the user’s input with the toUppercase or toLowercase methods.

Hope that helps. If not, let me know.