Is a JavaScript method used for displaying an interactive list of the properties of a specified JavaScript object. It is particularly useful for examining the structure and contents of complex objects, such as DOM elements or custom JavaScript objects.
Here's how `console.dir()` works with an example:
const person = {
firstName: "John",
lastName: "Doe",
age: 30,
address: {
street: "123 Main St",
city: "Anytown",
state: "CA",
zip: "12345",
},
};console.dir(person);/* output:
Object
age: 30
address: Object
city: "Anytown"
state: "CA"
street: "123 Main St"
zip: "12345"
firstName: "John"
lastName: "Doe"
*/