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 Loops, Arrays and Objects Simplify Repetitive Tasks with Loops The Refactor Challenge Solution

Jason Widjaja
Jason Widjaja
7,904 Points

why is index html error

everytime i want to access index.html on the console it always pops up as this : <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Color Blocks</title> <link rel="stylesheet" href="css/styles.css"> </head> <body id="color"> <script src="js/script.js"></script> </body> </html> VM36:1 Uncaught SyntaxError: Unexpected token '<' I do not know where the error lies pls help

2 Answers

Steven Parker
Steven Parker
229,644 Points

This HTML seems valid, i don't see any errors. But exactly what do you do "to access index.html on the console"?

And to enable accurate replication of the issue, make a snapshot of your workspace and post the link to it here.

Jason Widjaja
Jason Widjaja
7,904 Points

everytime i copypaste the code in console which is ctrl+shift+j it always shows error idk why because I have not touched the code at all https://w.trhou.se/evqipjc6xx

Steven Parker
Steven Parker
229,644 Points

I'm still a bit confused about the process where you "copypaste the code in console".

The typical way to run a project in the workspace is to click on the "Preview Workspace" button in the upper right (the symbol looks like an eye). This opens a new window in your browser and displays your project in it. When I try your snapshot I see a window with 10 colored dots, which seems correct for the exercise.

It seems you try running the index.html content instead of the script.js content. To use the browser console in order to run your code, you use the javascript code not the html. Try pasting your script.js content to the console instead of the index.html.