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

Derek Hutson
Derek Hutson
9,740 Points

Is toUpperCase being used correctly?

Hi all,

I made it through conditional statements, but I consistently had a hard time getting the program to recognize toUpperCase function even though it seems like I typed it out correctly.. Is that the error I made here? Or is it something else? Or both? Thanks!


1 Answer

Steven Parker
Steven Parker
229,018 Points

The use of the "toUpperCase" method seems correct in this code, but I see a few other issues:

  • there's a missing closing brace on or near line 24
  • another closing brace is missing before line 35
  • on line 14, "parseInt" is being used as if it were a string method
  • it might be more consistent to compare the number as a string like the other questions
  • if you do convert the input to a number, it should be compared to just 2 instead of "2"