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 Tracking Multiple Items with Arrays Useful Array Methods

Victor Warner
Victor Warner
1,882 Points

copied the search.js code to try a two-dimensional array but kept getting issues also what is ${xxx} used for?Scope var?

Basically used the code from search.js in a new file called peach.js. However when try to run it, I'm told the last else and my break is an unexpected token and illegal? Tried to play around with the code to see if it works for two-dimensional array.

Lastly I saw someone used ${xxx} in their code, which is to call the var within a function scope.? From what I have read its a shortcut for document.getElementById but that was with $(). Also, I don't quite understand the use of _ if anyone has pointers on that too.

Thank You

https://w.trhou.se/hj4koujve2

1 Answer

Steven Parker
Steven Parker
231,236 Points

The conditional block that starts with the open brace on line 13 has not been closed (with a closing brace) when the "else" statement on line 15 is reached. There is also a stray closing brace on line 23, perhaps that was intended to go between lines 14 and 15?

Also, on line 10 you have "serach" instead of "search".

And "${xxx}" looks like a replacement expression in a template literal. But to be sure, please show the actual code (or provide a link to it).