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

Danny Rubio
Danny Rubio
2,546 Points

Random question on displaying the value.

I noticed that you used the alert function but I was wondering if you could use the document.write function?

Bogdan Cabaj
Bogdan Cabaj
16,348 Points

HI Danny,

You can always use console.log() to write out to console (developer tools). Personally I don't use document.write as it messes up with your content on the page.

Thanks, Bogdan

2 Answers

Mike Hickman
Mike Hickman
19,817 Points

Hi Danny,

I'm not sure which point in the Javascript course you're at, so here's a quick overview:

alert("message here") - will pop up a separate alert window

console.log("message here") - will print the message to your terminal/console

document.write("message here") - will insert the message onto the actual html page

If you're asking for a specific test/quiz, you'll have to do it how Treehouse wants, but for your own use you can use whichever method you prefer or need.

Cheers,

Mike

Danny Rubio
Danny Rubio
2,546 Points

I think that works! ** Thanks!**