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 The Solution

Mark Chang
Mark Chang
5,214 Points

My alert didn't pop up!

Idk what wrong of my code but the alert didn't pop up when I preview the workspace!

Code (click practice.js for the code) : https://w.trhou.se/2xtfsnvm4w

Frans de Haan
Frans de Haan
6,303 Points

Can you share your code

Mark Chang
Mark Chang
5,214 Points

Sorry for that i just forgoted

1 Answer

Frans de Haan
Frans de Haan
6,303 Points

Hello Mark Chang,

It need to be like this:

var firstname = prompt("What is ur first name?");

var lastname = prompt("What is ur last name?");

var completename = firstname.toUpperCase() + ' ' + lastname.toUpperCase();

var charaterCount = completename.length;

alert("The string \"" + completename + "\" is " + charaterCount + "characters long.");

In the alert you used a uppercased n in completename variable. And I switched the 3 and 4 rule because you can't tell the length if it's not defined jet.

Mark Chang
Mark Chang
5,214 Points

Thx for answering my question :)