FrontendDeveloper.in

JavaScript question detail

What is the purpose of dir method of console object

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

Back to all JavaScript questions
Get LinkedIn Premium at Rs 399