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
182,603 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).