How to print console without trailing newline in Node.js ? Last Updated : 07 Mar, 2024 Comments Improve Suggest changes Like Article Like Report In Node.js, console.log() method is used to display the message on the console. By default, the console.log() method prints on console with trailing newline. Example 1: javascript // Node.js program to demonstrate the // console.log() Method console.log("Welcome to GeeksforGeeks! "); console.log("A computer science portal for geeks"); Output: Welcome to GeeksforGeeks! A computer science portal for geeks In the above example, Welcome to GeeksforGeeks! printed on first line and A computer science portal for geeks printed on second line. But sometimes we may need to print the console without trailing newline. In that case, we can use process.stdout.write() method to print to console without trailing newline. Example 2: javascript // Node.js program to demonstrate the // process.stdout.write() Method process.stdout.write("Welcome to GeeksforGeeks! "); process.stdout.write("A computer science portal for geeks"); Output: Welcome to GeeksforGeeks! A computer science portal for geeks Note: The process object is global so it can be used without using require() method. Comment More infoAdvertise with us Next Article How to print console without trailing newline in Node.js ? D DivyaRani1 Follow Improve Article Tags : JavaScript Web Technologies Node.js Node.js-Misc Similar Reads What is stacktrace and how to print in node.js ? Stacktrace in Node is a report that displays the error along with the path or sequence of execution. It provides the sequence of function calls or operations that led to an error in a program. It helps to debug the issues by providing the path of execution.A Stack trace is displayed automatically by 3 min read How to Show the Line which Cause the Error in Node.js ? Debugging is a critical part of software development. When an error occurs in a Node.js application, understanding exactly where it happened is essential for diagnosing and fixing the problem. Node.js provides several ways to pinpoint the line of code that caused an error. This article explores thes 4 min read How to print command line arguments passed to the script in Node.js ? Node.js is an open-source and cross-platform runtime environment built on Chrome's V8 engine that enables us to use JavaScript outside the browser. Node.js helps us to use build server-side applications using JavaScript. In Node.js if you want to print the command line arguments then we can access 2 min read How to build your own CLI (Command Line Interface) with Node.js ? Introduction: A command-line interface (CLI) is a text-based user interface (UI) for running programs, managing files, and interacting with computers. Building your own CLI is easier than you might think with Node.js. There are a bunch of open-source packages that can handle color, animation, and us 2 min read How to Print to Console an Object in a MongoDB Script? MongoDB queries can sometimes be slow, especially when dealing with large datasets or complex queries. So there are some methods or approaches that allow the developers to check the data and spot mistakes during the program run. In this article, we will learn about How to Print to Console an Object 3 min read Like