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

task 2 java basics

still getting problems

app.js
 firstName=("Malcolm");
 lastName= ("Mowlam");
 role = 'developer';
 firstName=("Carlos");
 lastName=("Salgado"); role=("developer");
 msg = "firstname" ' + ' "lastname" ' + ' "role":"
console.log = msg

I'm getting fed up with keep getting property 1 is null and every time i go back i have to start from the beginning but thank you for your help it was really appreciated

Tomasz Grodzki
Tomasz Grodzki
8,130 Points

You gettin this error because you have obvious mistakes.

Mistakes that make error:

  1. You didn't declared variables. You need to use a statement (like let or var) to declare variable
  2. You concatenate strings in wrong way. You have needless quotes. When you should quotes everything inside quotes is treated just like string, with any additional meaning. If you want to use operators like + you shouldn't use quote. Well... You can use quote but then + will be treated just like sign, not like an operator.

So in this case it should looks like:

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

Mistakes that doesn't make errors in this challenge but are mistakes:

  1. You don't need to parenthesis to assign a value.
  2. Why are you tryin to assign values to variables twice?
  3. Why you wrote 'console.log = msg'?

2 Answers

Tomasz Grodzki
Tomasz Grodzki
8,130 Points

Firstly, you don't have to start new topic to every new problem with the same task. You can make responses in the same topic.

Secondly, read carefully my post from your previous topic, please. Why u wrote + in quotes? I wrote you in previous response, that if you write any sign in quotes it's treated just like sign, without any additional meaning or reference.

And thirdly, it's not Java it's JavaScript.

Take care and happy coding!

Get cannot read property 1 of null