JS Coding Questions Logo
JS Coding Questions
#373💼 Interview💻 Code

What is the purpose of dir method of console object

Advertisement

728x90

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

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

The user object displayed in JSON representation

Screenshot

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 31

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
373of476