JavaScript AJAX Basics (retiring) Programming AJAX Parsing JSON Data

console.log output array()

I tried the video and the console.log the employee but it says it is an array. But in the video, it says its objects

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
  if(xhr.readyState === 4){
    var employee = JSON.parse(xhr.responseText);

Jess Taylor
Jess Taylor
5,160 Points

You will get objects back, but It should be an ARRAY of objects :

If you look at your console window you should be able to see a set of square brackets on the outside, showing an array, and then all of the objects inside that array encased in these brackets { } to show that they are objects.

[{Object}, {Object}, {Object}....etc]