Open In App

Node.js console.dirxml() Method

The console.dirxml() method calls console.log() method by passing the received argument, this element does not produce any XML formatting.

Syntax:



console.dirxml(object_or_element)

Parameters: This function accepts the following parameter:

Return Value: This method returns the object or element passed.



Below examples illustrate the use of process.memoryUsage() method in Node.js.

Example 1: 




// Importing console module
const console = require('console'); 
  
var a = 'GeeksforGeeks';
  
// Calling console.dirxml() function
console.dirxml(a)

Run the index.js file using the following command:

node index.js

Output:

GeeksforGeeks

Example 2: Create an index.js file with the following code.




// Importing console module
const console = require('console'); 
  
// Calling console.dirxml() function
console.dirxml("Hi there, Geeks")

Run the index.js file using the following command:

node index.js

Output:

Hi there, Geeks

Reference: https://nodejs.org/api/console.html#console_console_dirxml_data

Article Tags :