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

Help With Javascript code

Can anyone tell me what is wrong with this code please. I have a book with the following code.

1st) First script block should appear with text paragraph 1 2nd) Second script block with text Paragraph 2 3rd) Paragraph 1, Paragraph 2, Paragraph 3 appear together

However this code seems to not be working. Can you please tell me where Im going wrong?

<script> alert ("Third Script Block"); </script>

With the code I get

<!DOCTYPE>

<html lang="en"> <head> <meta charset="utf-8" /> <title>Chapter 1, Example 2</title> </head> <body bgcolor="white">

    <p>Paragraph 1</p>
    <script>
        alert ("First Script Block");
    </script>


    <p>Paragraph 2</p>
    <script>
        alert ("Second Script Block");
    </script>

    <p>Paragraph 3</p>
    <script>
        alert ("Third Script Block");
    </script>
</body>

</html>

1 Answer

It all works for me, could you be a little more clear on what doesn't seem to work for you?