Console dir()
Example
const person = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};
console.dir(person);
Try it Yourself »
Description
The console.dir() method displays an interactive, hierarchical
listing of the properties of a specified JavaScript object.
The console.dir() method provides a more detailed view than
console.log() for complex objects.
Syntax
console.dir(object)
Parameters
| Parameter | Description |
| object | Required. The object to write to the console. |
Return Value
| NONE | (undefined) |
Browser Support
console.dir() is an ECMAScript5 (ES5 2009) feature.
JavaScript 2009 is supported in all browsers since July 2013:
| Chrome 23 |
IE/Edge 11 |
Firefox 21 |
Safari 6 |
Opera 15 |
| Sep 2012 | Sep 2012 | Apr 2013 | Jul 2012 | Jul 2013 |