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 (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
215,987 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"