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 Data Using Objects The Student Record Search Challenge Solution

1 Answer

Hi there,

The issue with the prompt seems to be on line 11 of student_report.js - the error is about closing parentheses, but it's actually the quotes in the string. Currently, there are single quotes around the string, but single quotes are also used inside the string. When it hits another single quote, it's going to think the string is ending, and the rest of the code there will just cause an error because it doesn't recognize it as the rest of the string. You can get around this by using an escape character "\" before each of the single quotes, or by using double quotes in the string. Your options are:

  • (or type \'quit\' to exit) - the escape character won't show up, it just tells it not to end the string here
  • (or type "quit" to exit)
  • leave the string as-is, but enclose the whole thing in double quotes instead

When you get something not loading, there's usually a syntax error somewhere. You can pull up the JavaScript console in the browser to help figure out what's going on - in Chrome it's ctrl-shift-j and in Firefox it's ctrl-shift-k. Hope this helps!

Daniel Lee
Daniel Lee
Courses Plus Student 566 Points

I believe I fixed the issue but the prompt window still does not show up. Could you please help me out another time? Thanks

https://w.trhou.se/xnuh8glaaw

Hi again,

On this one, it's not loading because there's a loop that isn't closed. Here's the snippet in question:

for (var i = 0; i < students.length; i++) {
  search = prompt("Please type a name to look up student directory. Type quit to exit");
  if (search.toLowerCase === 'quit') {
    break;
     //need a curly brace here
}

Right now, it's closing the 'if' block, but not the 'for' loop. If you add that curly brace, the prompt comes up again.