Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
MOD
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Treehouse Moderator

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.