JavaScript AJAX Basics (retiring) Programming AJAX Parsing JSON Data

Trying to follow along with Parsing JSON Data video but getting error

When I try to follow along with this video, including opening the console, I get an error message that appears to be rooted in the 4th line of my widget.js, and specifically with the content inside the console.log().

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
    console.log(typeOf xhr.responseText);
};'GET', 'data/employees.json');

When I put my cursor over the content of my console.log, I get the following msg:

"Uncaught SyntaxError: missing ) after argument list"

I'm not seeing why there's an error here, and hoping another pair of eyes can spot it.

2 Answers

28,430 Points

The typeof operator should be written all in lowercase, not in camelCase like it is in your code. If you change its name like this:

console.log(typeof xhr.responseText);

Then that will likely fix that error.

Thank you!