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 AJAX Basics (retiring) jQuery and AJAX Stage 3 Challenge Answer

Kevin McNamara
Kevin McNamara
7,483 Points

Can't figure out my error

I am looking through my code, but can not figure out why it is not working. Here is the link to my snapshot:

https://w.trhou.se/zo6d3x7845

Thanks!

Michael Caveney
Michael Caveney
50,144 Points

Lines 13 and 27........does adding semi-colons to definitively end those statements change anything?

Aaron Martone
Aaron Martone
3,290 Points

It's a bit more respectful of your community if you provide information about what it is you're trying to do, what is not working, and what you've tried to resolve it rather than just saying "Here's my code, figure out what is not working." It's OK to ask for help, but you should be mindful of trying to help us help you, and give us a complete context about what it is that has stumped you. Sorry if it sounds rude, I don't mean to be.

2 Answers

Abraham Juliot
Abraham Juliot
47,353 Points

Hi Kevin, actually, sharing your work space made it easier to debug in this case. I just opened the dev tools console and it pointed the errors out for me.

lines 17 and 26 are where the errors are thrown.

var roomHTML = '<ul class="rooms">

roomHTML += '</ul>

just close these two strings with '

Great work by the way

A tip for anyone else having syntax errors like this (which happen all the time). When using a text editor like Atom or Sublime, or an IDE like Webstorm, you need to enable linting and you'll be notified in real-time that your code will break - before you even hit save.

I personally use ESLint and it can be a bit of a task for a beginner to get up and running; but once you have it set up, it works perfectly. It was definitely worth the few hours I spent reading the docs and figuring out how to get it working globally (for all my JavaScript files).

Aside from syntax errors, you can also enable style rules like forcing the use of let and const instead of var, or forcing arrow functions. You can even use built-in guides from Airbnb or Google to write your code using the same style guide that their in-house developers use.

It's an invaluable tool that I wish I discovered months ago. Hopefully anyone reading this will give it a shot and no longer spend hours looking for a missing quotation mark or comma.