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 (Retired) Making Decisions with Conditional Statements The Conditional Challenge Solution

Equally good to use .toLowerCase() instead of .toUpperCase()?

Hi

I see you always use .toUpperCase() for checking user input.

I find it cleaner to use .toLowerCase() and check (for example) for answer === 'hypertext markup language' instead of answer === 'HYPERTEXT MARKUP LANGUAGE'

Is there any reason except for preference that you use .toUpperCase()?

Like, are some uppercase characters not converted correctly when you use .toLowerCase() while everything works correctly when converting lowercase characters to uppercase?

Thanks in advance

Dave McFarland

1 Answer

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

You are correct Kenny Brijs. It's just a preference, which you choose, for these examples. toLowerCase() is just as good for making a comparison like this. Good job thinking through this question!

Damn you're fast, thanks! ;)