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 JavaScript Basics Working with Strings Variables and Strings Challenge Solution

paragraph is not showing up on the browser. checked the .js links and everything is fine. no error in the console.

// const firstName = prompt("type first name"); const lastname = prompt("type last name"); const sentence= <p>your first name is ${firstName} and you last name is ${lastname}</p>; Document.querySelector('main').innerHTML= sentence;

2 Answers

Joseph Yhu
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Joseph Yhu
PHP Development Techdegree Graduate 48,463 Points

I believe Document should be in lowercase. Also did you comment out const firstName = prompt("type first name");? I noticed the //.

devin blair
devin blair
1,795 Points

First problem is I think you commented out your vars. // const firstName = prompt("type first name"); const lastname = prompt("type last name");.

const firstName = prompt("type first name"); const lastname = prompt("type last name");

The second is you missed the backticks in your sentence var it should be const sentence = `<p>your first name is ${firstName} and you last name is ${lastname}.</p>`;

and lastly, you just need to change the uppercase d in Doucment.querySelector to a lowercase d

I wish I could explain the backticks part more but im a beginner as well there's some docs on template literals on MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals Hope you found your answer :)

all together it will look like

const firstName = prompt("type first name");
const lastname = prompt("type last name");

const sentence = `<p>your first name is ${firstName} and you last name is ${lastname}.</p>`;
docuemnt.querySelector('main').innerHTML = sentence;