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 Basics (Retired) Introducing JavaScript Your First JavaScript Program

add a code inside the <script> tag with the words "Welcome to my site" onto the web page

java script

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

<body>
</body>

<script>
  <alert:"Welcome to my site">
</script>

</html>

Same problem: i have wrote: <script> document.write("<h1>Welcome to JavaScript basic</h1>"); </script>

9 Answers

Pedro Sousa
seal-mask
.a{fill-rule:evenodd;}techdegree
Pedro Sousa
Python Development Techdegree Student 18,546 Points

Hi,

In the preceding video, there are 2 methods shown:

  • alert
  • document.write

I think you're trying to use the alert (but note that you're using a wrong syntax) but what you need to do is just a simple document.write.

This should do it for you:

<script>
     document.write("Welcome to my site")
</script>
Greg Kaleka
Greg Kaleka
39,021 Points

Good answer Pedro! I fixed a small typo in your code for you :)

I am writing this code document.ready("Welcome to my site");

But, still it is not passing the test. What I am doing wrong?

document.write("Welcome to my site");

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

Lol, ignore my comment. I got it fixed. I wrote ready instead of write.

document.write("Welcome to my site");

August Oliver
August Oliver
5,933 Points

document.write("Welcome to my site");

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

i tried this and all it said wasSyntaxError: Parse error. please get me through this.