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 practice problem code.

This is the first time ive posted on the forum here. I believe my code for this exercise works fine, just wanted to get your guys oppinion. Maybe theres a spot or two where it can be "cleaner" Thanks again.

var firstInput = prompt("What is your first name"); var secondInput = prompt("What is your last name"); var comboInput = firstInput.toUpperCase() + " " + secondInput.toUpperCase(); var finalResult = comboInput.length; alert("The string \"" + comboInput + "\"" + " is " + finalResult + " characters long.");

Sergio Leon
Sergio Leon
12,594 Points

I'd say everything is okay, but what about using template literals? I guess you're watching some of the all videos, before the introduction of ES2015.

Here's the link to the template literals tutorial. Once you get used to doing things this way, you will absolutely love it.

https://teamtreehouse.com/library/introducing-template-literals

1 Answer

Thanks for the link Segio. You're correct, I havent got to the literals sections yet. Looking forward to it.