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

I am missing a point and can't use .toUpperCase

Hi guys,

Please take a look at my code; https://w.trhou.se/ina0bm9mqe

Firstly, when I give all the right answers, it still only gives me 4 points. I don't know what I'm doing wrong! And secondly, I wanted to add .toUpperCase for the answers, but it gives me a SyntaxError. How should I add the .toUpperCase? What I did now was; var answer2A.toUpperCase = ("BLACK");

Thanks in advance!

2 Answers

Steven Parker
Steven Parker
229,732 Points

The type-sensitive compare ("===") won't match a string with a number, but you could store all the answers as strings. Also, you do not need to place parentheses around literal strings:

var answer1A = '23';

And when you invoke a method, you must put parentheses after the method name whether it takes any arguments or not. For example:

if (answer2A.toUpperCase() === "BLACK") {

The syntax error you experienced was caused by attempting to redeclare an existing method as a string.

Thank you, Steven!