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 trialDrew Van Roekel
463 PointsI'm extremely new to programming and I'm having some trouble with this question...
I'm having some trouble understanding the basics. Please help.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
</body>
<script>
<"Welcome to my site">;
</script>
</html>
2 Answers
andren
28,558 PointsIn the video preceding this challenge you were introduced to two functions, alert
and document.write
. Both of those functions performs some kind of action. The alert
function creates a popup containing the string (text) you pass to it and the document.write
function writes whatever string you provide it to the webpage itself.
Since the challenge asks you to write the words to the webpage the function you have to use is document.write
. The way you call and pass data into a function is by placing parentheses after the function name and then the value within those parentheses.
So if I wanted to write the message "Hello World!" to the webpage the code would look like this:
document.write("Hello World!");
The code you have to place within the script tags is pretty much identical, you just have to change the message from "Hello World!" to "Welcome to my site".
Edit: I see my response was a bit late, oh well as long as you managed to figure it out that's all that matters. I'll leave this response up in case others ends up struggling with the same challenge.
Thomas Fildes
22,687 PointsHi Drew,
Don't be afraid of not knowing something. Everyone starts off somewhere and have been in the same position as you :)
I used the following code below to pass this challenge:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
</body>
<script>
// Write your code here.
document.write("Welcome to my site");
</script>
</html>
Hope this helps! Happy Coding!!!
Keep it up :D
Drew Van Roekel
463 PointsDrew Van Roekel
463 PointsFigured it out. Thanks all :D