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

Carlos Rojo
Carlos Rojo
2,221 Points

alert (Welcome to my site);

alert syntax

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>
// Write your code here.
alert (Welcome to my site); 
</script>

</html>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The thing inside the parentheses to the alert should be a string. We indicate a string by placing quotation marks around it. Like so:

alert("Hi there, Carlos!");

Hope this helps! :sparkles:

Shayne Laufenberg
Shayne Laufenberg
4,213 Points

On your current challenge they would like you to write "Welcome to my site" inside your document. To do this you will use document.write(); and place that string inside your argument. I've posted a solution below so you can see how it works.

Solution:

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

<body>
</body>

<script>

  // Write on Our Document //
  document.write("Welcome to my site"); 

</script>

</html>

Note: (This is to answer the original question for this post, code above is to answer the challenge)

alert("Welcome to my site");

~Shayne