Categories
JavaScript Answers

How to create line breaks in console.log() in Node.js and JavaScript?

Spread the love

Sometimes, we want to create line breaks in console.log() in Node.js and JavaScript.

In this article, we’ll look at how to create line breaks in console.log() in Node.js and JavaScript.

How to create line breaks in console.log() in Node.js and JavaScript?

To create line breaks in console.log() in Node.js and JavaScript, we log the '\n' character.

For instance, we write

console.log({ a: 1 }, "\n", { b: 3 }, "\n", { c: 3 });

to call console.log with '\n' separating each object to log each object in their own line.

Conclusion

To create line breaks in console.log() in Node.js and JavaScript, we log the '\n' character.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *