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 Working with Strings Combine and Manipulate Strings

Susanna Clough
seal-mask
.a{fill-rule:evenodd;}techdegree
Susanna Clough
Full Stack JavaScript Techdegree Student 1,678 Points

Combine and manipulate strings Please HELP

My error message keeps popping up with spacing errors. Ive searched outside and on this app and cannot seem to get it right . I'm so frustrated. I've tried with quotes and without quotes, nothing works! Please help?!?!

app.js
let firstName = 'Susanna';
let lastName = 'Clough';
let role = 'developer';
let msg = firstname + ' ' + lastname + ':' + role;

4 Answers

Joshua Ordehi
Joshua Ordehi
4,648 Points

Hey Susanna,

Good to see you're learning JavaScript, it can be a pretty fun experience. Don't worry if you get frustrated at first, when you eventually get it and can build you own programs you'll feel great!

It looks like you're calling the firstname and lastname variables all in lower case, which don't exist because the variables you declared on lines 1 and 2 are lastName and firstName with capital N and JavaScript is a case sensitive language. Changing your msg declaration to this should help:

let msg = firstName + ' ' + lastName + ':' + role;

The result of that should be:

Susanna Clough:developer

You might also want to add a space after the colon ":" like this:

let msg = firstName + ' ' + lastName + ': ' + role;

That way your result should be: Susanna Clough: developer

By the way, the error message you get in the console with the code you had should be something like this:

VM403:4 Uncaught ReferenceError: firstname is not defined at <anonymous>:4:11

This gives you a clue where it says "firstname is not defined" that means the variable you're trying to read has not been declared, so if that ever happens to you again, try looking for the code that's calling the variable and comparing it with the actual variable name to make sure it's declared and being called correctly.

VM403:4 means the error happened on line 4 of your code, in this case, VM403 refers to the console because that's where I tried to run your code, but you'll usually see the file name such as script.js:4 which is useful to help you locate where the error originated.

Hi,what is the error message show?

Hello Susanna Clough

I noticed that for let msg

you entered

let msg = firstname + ' ' + lastname + ':' + role;

Try upper-casing the N inside firstname and upper casing the N inside lastname

let msg = firstName + ' ' + lastName + ':' + role;

Let me know if that works. :)

Add an extra space after the colon ': ' Aside from that, JS is case-sensitive so the capitalization in the variables must be consistent:

let firstName = 'Susanna'; let lastName = 'Clough'; let role = 'developer'; let msg = firstName + ' ' + lastName + ': ' + role;