Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Basics!
You have completed JavaScript Basics!
Preview
You've learned three different ways to output messages with JavaScript. Let's put these pieces together and write a small program using those methods.
Resources
alert()– MDNconsole.log()– MDNdocument.write()– MDN- Other ways to clear the console
- Grammar and types – MDN
Code Snippet
alert("Hello. Thanks for visiting!");
console.log("Hello from the console.");
document.write("<h1>Welcome to my web page.</h1>");
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
writing to the current web page.
0:00
Let's put these pieces together and write
a small program using these three methods.
0:00
If necessary,
clear the console to add new code.
0:04
First, type alert.
0:07
And in between quotation marks,
type the message Hello.
0:11
Thanks for visiting.
0:17
Now, I don't want to run this code yet, so
I'll press and hold down the shift key.
0:21
Then press enter to bring the cursor down
to the next line without running the code.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up