In modern Node.js (and JavaScript in general), multi-line strings are natively supported using template literals introduced in ES6 (ECMAScript 2015). These allow multi-line strings directly and work in both Node.js and modern browsers.

const multiLineString = `
This is a multi-line string.
You don't need any special syntax
like \n\ for new lines.
It works natively!`;

console.log(multiLineString);

 

Support On Demand!

Node

Related Q&A