Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To modify the width of the printed output of node's console.log, you can use the util.inspect method with the maxWidth option.

Here's an example:

const myObj = {
  name: "John Doe",
  age: 30,
  location: "New York"
};

console.log(util.inspect(myObj, {maxWidth: 50}));

In this example, the util.inspect method is used to print the myObj object with a maximum width of 50 characters. You can change the maximum width to your desired value.