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) Working With Numbers The Mad Libs Challenge Revisited

Carleen Hall
seal-mask
.a{fill-rule:evenodd;}techdegree
Carleen Hall
Front End Web Development Techdegree Student 3,158 Points

Why is it that the number "3" is not showing up in my prompt? Please help!

Here is my code. Hope the link work this time around. Thanks.

https://w.trhou.se/4cz4co45i0

var questions = 3;
var questionsLeft = "[" + questions +  "questionsLeft ]";
var adjective = prompt("Please type an adjective " + "questions left");
var sentence = "<h2>There once was a " + adjective;
var noun = prompt("Please type an noun");
var verb = prompt ("please type a verb")
alert("All done, let's what you came up with")
sentence += noun + "who know how to code she was so happy, she started ";
sentence += verb + "she was up all night.";
document.write(sentence);

Please create a snapshot of your workspace. We can not access your workspace with your link

2 Answers

Matthew Carson
Matthew Carson
5,965 Points

I'm going to guess you want the 3 to appear on the third line.

You aren't concatenating the questionLeft variable in the prompt string.

You set the questionsLeft variable to "[3questionsLeft ]"

Doing this:

var adjective = prompt("Please type an adjective " + questionsLeft);

Would return a prompt with:

Please type an adjective [3questionsLeft ]