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

Related questions

0 votes
asked Oct 8, 2023 in JavaScript by JackTerrance
0 votes
asked Sep 29, 2023 in JavaScript by JackTerrance
...