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

App will not display prompt answers until I cancel prompt.

When I search a name in prompt, the prompt pops back up just like video demo. But in the demo, the HTML response shows up as well as prompt reappearing. Mine doesn't show up until I actually click cancel on prompt? Any suggestions?

while (true) {
    search = prompt('Search for records. Type list to show all, quit to exit.')
    if (search === null || search.toLowerCase() === 'quit') {
        break;
    }
    for (var i = 0; i < students.length; i++) {
        student = students[i];
        if (student.name === search) {
            message = getStudentReport(student);
            print(message);
        }
    }
}

1 Answer

Steven Parker
Steven Parker
243,318 Points

Modern browsers tend to behave differently than they did when the video was made. In particular, page rendering is no longer done until the JavaScript program finishes.

You didn't mention which course you were in (or link to it), but I recall this being discussed in the "Teacher's Notes" section in at least one of the courses.

Ok great, that makes sense!! Just wanted to clarify it wasn't something I wrote wrong! Oh, and it was in the full stack JavaScript, the last project under objects and arrays.

Thanks again.