Displaying objects and XML interactively - console.dir, console.dirxml

suggest change

console.dir(object) displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.

const myObject = {
    "foo":{
        "bar":"data"
    }
};

console.dir(myObject);

displays:

console.dirxml(object) prints an XML or HTML representation of the object's descendant elements when it can, and the JavaScript representation otherwise. On an HTML or XML element it matches console.log(). document exists only in a browser.

Example 1:

console.dirxml(document)

displays:

Example 2:

console.log(document)

displays:

Example 3:

const myObject = {
    "foo":{
        "bar":"data"
    }
};

console.dirxml(myObject);

displays:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents