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 Foundations Variables Basics

Gina Bégin
PLUS
Gina Bégin
Courses Plus Student 8,613 Points

In myscript.js, set bgColor to "blue" and textColor to "FF9933". Can't get it...?

I have this code — it keeps telling me I haven't set the bgColor. I've tried a few different configurations. What am I doing wrong?

<script src="myscript.js"> var bgColor = "blue"; var textColor = "#FF9933"; </script>

Gina Bégin
Gina Bégin
Courses Plus Student 8,613 Points

Sorry, I forgot the markdown:

<script src="myscript.js">
       var bgColor = "blue";
      var textColor = "#FF9933";
    </script>

2 Answers

Hugo Paz
Hugo Paz
15,622 Points

Hi Gina,

Your code is correct. You just put it in the wrong place. You need to put the variables inside the myscript.js file. You can see a tab on the challenge window with that name.

If the instructions were to add those variables in myscript.js, then you don't need the <script></script tags. Those script tags are for use in html files.