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 trialFrancesco Nasso
5,427 PointsThe Variable Challenge - Syntax Error
Hello,
I am attempting 'The Variable Challenge activity' and seem to be encountering an error with my code that causes my program to stop after prompting for a noun. My goal for the program is to ask the user for a noun, change that input to lower case, and then output that lower cased form on the webpage. I want to repeat this for a verb and an adjective as well.
Any recommendations on what I'm doing wrong and why it is wrong? Thanks!
//Variable list
var noun; var verb; var adjective;
//Prompts for adlibs
noun = prompt("Type in a noun"); console.log(noun); noun = noun.tolowerCase();
verb = prompt("Type in a verb"); console.log(verb); verb = verb.tolowerCase();
adjective = prompt("Type in an adjective"); console.log(adjective); adjective = adjective.tolowerCase();
//Output
document.write("One day, " + noun + "decided to_" + verb + "_" + adjective + "down the street.");
Any recommendations?
2 Answers
Steven Parker
231,236 PointsYou have "tolowerCase" (little "l") instead of "toLowerCase" (capital "L") in 3 places.
Then just for appearance, you might want to add some spaces and remove the underscores from the strings in the final statement.
Jazz Jones
8,535 PointsThe lower case method should be noun.toLowerCase(); you didn't capitalize the 'L' in any of your methods.
Francesco Nasso
5,427 PointsFrancesco Nasso
5,427 PointsThank you!