Welcome to the Treehouse Community
Looking to learn something new?
seth aruby9,354 Points
Why const vs let when assigning new XMLHttpRequest() object to variable?
Noticed that when completing this challenge using the 'let' keyword for assigning XMLHttpRequest() object to the variable was failing. So had to use const instead. Wondering why? Thanks in advance...
let request = new XMLHttpRequest();
Steven Parker221,324 Points
That does seem odd. I have two wild guesses:
- they wanted to enforce the "best practice" use of "const" over "let" (but "var" also works)
- an older challenge checking mechanism was only partially updated for ES2015 syntax