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

Feedback on my take on the practice

Helloooo,

Looking for feedback on my take on the practice video of variables, input & output in javascript!

var firstName = prompt ("What is your first name?");
var lastName = prompt (" What is your second name?");
var fullName = firstName.toUpperCase()+ ' ' + lastName.toUpperCase();
var numOutput = alert("Your name " + fullName + " is " + fullName.length + " characters long.");

3 Answers

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Looks great and does what is intended! Only thing I could think of that maybe you could add to further improve the purpose and description of the variables is the last one numOutput has one purpose on this script like the others. The other three variables have clear meanings for this script, I would personally rename the variable to something like nameLength or stringLength. It just gives it that more clarity when reading and understanding the purpose the variable since numOutput could also consider to be calculating numbers for example.

Thank you! =D yes I was struggling with a name for that one.

Question: Won't this solution calculate the number of characters including the space?