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 Asynchronous Programming with JavaScript What is Asynchronous Programming? Examples of Synchronous and Asynchronous Code

Help: I didn't saw a change made to the asynchronous code in the second example. Additionally I cant unzip the workfile

... Because there is one file with a question mark in it. But that's only a minor problem.

Elisa Burghard
Elisa Burghard
9,276 Points

changes I saw:

  • line 3(synchronous) to line 4(asynchronous) xhr.open('GET', url) // omitted 'false'
  • line 10(synchronous) to line 11(asynchronous) xhr.send() // omitted 'null'

Hope this helps and happy coding!

1 Answer

Hi, The 3rd arg in the open() method was updated from false to true. Originally it was set as false. Guil simply removed the 3rd arg since it's optional. If the 3rd arg isn't explicitly set JavaScript uses true as its default value. You can explicitly set it to true if you'd like but it's not necessary.

open(method, url, async)

More Info https://www.w3schools.com/js/js_ajax_http_send.asp