0 votes
in JavaScript by
What is the purpose of dir method of console object in Object?

1 Answer

0 votes
by

The console.dir() is used to display an interactive list of the properties of the specified JavaScript object as JSON.

const user = { name: "John", id: 1, city: "Delhi" };
console.dir(user);

The user object displayed in JSON representation Screenshot

...