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 Loops, Arrays and Objects Tracking Data Using Objects The Build an Object Challenge, Part 2 Solution

Priyanka INGOLE
Priyanka INGOLE
6,467 Points

print(message); Above line is opening print command in Chrome which shows me print preview of the page.

print(message); Above line is opening print command in Chrome which shows me print preview of the page.

I am not able to print on screen, as shown in the video, with this command.

Please help.

I wanted to attach a screen shot but can't see how can i do it,

2 Answers

Pretty sure I understand what error is happening here. So if you're calling the function print() without declaring it as a function specifically to print the message output to the page you are probably calling the vanilla window.print() function located here: https://www.w3schools.com/jsref/met_win_print.asp

This is not the same function that is declared in the video, and this video helps explain his method for declaring his own print(message) function: https://teamtreehouse.com/library/build-a-quiz-challenge-part-2

hope this helps, Dylan

Linas Mackonis
Linas Mackonis
7,071 Points

If you'd paste the code (html and js), it would be easier.

Code Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```