Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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);


an array is also a type of object in JS read more

1 Answer

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]