JavaScript JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

Erick Hernandez
Erick Hernandez
1,079 Points

Document.write function for "Welcome to my site"

I am having trouble calling the document.write function for this question.

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>

<body>
</body>

<document.write>;
// document.write("Welcome to my site");

</script>

</html>

2 Answers

Tammi Carter
Tammi Carter
Full Stack JavaScript Techdegree Student 5,347 Points

Good Day Eric , you were almost there!

1st Remove <document.write>; completely. Than add your code in between your script tags like so:

<script>

document.write(‘Welcome to my site’);

</script>

Sean T. Unwin
MOD
Sean T. Unwin
Treehouse Moderator 28,648 Points

You have accidentally over-written the opening <script> tag.

You can either refresh the page and start again or:

Change:

<document.write>;
// document.write("Welcome to my site");

To:

<script>
// Write your code here.
document.write("Welcome to my site");

Note: The comment, "// Write your code here.", is not required.