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

I am getting an error in chrome as soon as I preview index page.

reports.js:1 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. d @ reports.js:1 t @ reports.js:1 c @ reports.js:1 (anonymous) @ reports.js:1 (anonymous) @ reports.js:1

and now the part of the code that prints the HTML Student Record data to the index page will only print after the prompt window is closed which means I can only see the last student I typed in.

I have added console.log commands and can see that the print function is called each time the search is executed and I have logged the results to verify the data is there and should print. However, since nothing prints until the prompt window closes ... they are never displayed ... except for the last one.

If I use a "msg += 'html' " format to append each student record - it will print all the records at one time once the prompt window is closed.

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Robin Harris! It sounds to me like you're doing great, and for the time being, I wouldn't worry much about the deprecation warning. As for the records not showing up until the window is closed, this is working as it should be and is addressed in the "Teacher's Notes". When the video was recorded, loops worked a little differently and would print while a loop was running. These days, loops wait until entirely finished before they do the printing. Again, take a look at the teacher's notes.

And yes, you would need the concatenation to print all students that match, otherwise the search result would be overwritten each time through the loop resulting in the only one being printed the last student.

Hope this helps! :sparkles: