Skip to content

console.dir()

Description

The console.dir() method displays a list of properties and methods of the specified JavaScript object. It is particularly useful for checking the structure and content of objects, as it formats the output in a list format that makes it easier to explore nested properties.

Syntax

JS
console.dir(obj: any) -> void

Parameters

Parameter Type Mandatory Description
obj any ✅ JavaScript object.

Return value

Type Description
void An empty value.

Example

JS
// Define the object
const obj = {
  name: "MotorXP",
  version: 1.0,
  features: ["AFM Design", "Electromagnetic Analysis", "Optimization API"],
  details: {
    developer: "MotorXP Team",
    license: "Combo",
  },
};

// Output methods and properties of the object
console.dir(obj);
Output
 Object
  name: "MotorXP"
  version: 1
   features: Array(3)
      0: "AFM Design"
      1: "Electromagnetic Analysis"
      2: "Optimization API"
   details: Object
      developer: "MotorXP Team"
      license: "Combo"
Last update: 14 August 2025, 18:47