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 Introducing Conditional Statements

Question regarding last part of video relating to toUpperCase() method

Just out of personal curiosity, I tested the toLowerCase() method in the quiz.js workspace, but my code wouldn't pass if I used any upper case letters in my input. Does anyone know why toLowerCase() will not work like toUpperCase()? Should they work the same? I'll paste my code below:

var answer = prompt("What programming language are you using right now?");
if (answer.toLowerCase() === 'javasript') {
  document.write('<p>You are awesome!</p>');
} else {
  document.write('<p>You are alright</p>');
}

1 Answer

It is perfectly fine to use the function on strings that are capital letters:

.toLowerCase() 

The reason why your code did not run properly is because of the minor type error you made. Remember typo is very important!

here is the mistake, you said javasript rather than javascript

if (answer.toLowerCase() === 'javasript')

Ok thank you. I totally missed that.