- Node.js Tutorial
- Node.js - Home
- Node.js - Introduction
- Node.js - Environment Setup
- Node.js - First Application
- Node.js - REPL Terminal
- Node.js - Command Line Options
- Node.js - Package Manager (NPM)
- Node.js - Callbacks Concept
- Node.js - Upload Files
- Node.js - Send an Email
- Node.js - Events
- Node.js - Event Loop
- Node.js - Event Emitter
- Node.js - Debugger
- Node.js - Global Objects
- Node.js - Console
- Node.js - Process
- Node.js - Scaling Application
- Node.js - Packaging
- Node.js - Express Framework
- Node.js - RESTFul API
- Node.js - Buffers
- Node.js - Streams
- Node.js - File System
- Node.js MySQL
- Node.js - MySQL Get Started
- Node.js - MySQL Create Database
- Node.js - MySQL Create Table
- Node.js - MySQL Insert Into
- Node.js - MySQL Select From
- Node.js - MySQL Where
- Node.js - MySQL Order By
- Node.js - MySQL Delete
- Node.js - MySQL Update
- Node.js - MySQL Join
- Node.js MongoDB
- Node.js - MongoDB Get Started
- Node.js - MongoDB Create Database
- Node.js - MongoDB Create Collection
- Node.js - MongoDB Insert
- Node.js - MongoDB Find
- Node.js - MongoDB Query
- Node.js - MongoDB Sort
- Node.js - MongoDB Delete
- Node.js - MongoDB Update
- Node.js - MongoDB Limit
- Node.js - MongoDB Join
- Node.js Modules
- Node.js - Modules
- Node.js - Built-in Modules
- Node.js - Utility Modules
- Node.js - Web Module
- Node.js Useful Resources
- Node.js - Quick Guide
- Node.js - Useful Resources
- Node.js - Dicussion
NodeJS - console.info() Method
The Node.js console.info() method of node.js is used to print information to stdout in a new line. It is an alias of the Console.log() method.
Using these two methods we can print the given messages to the standard output stream (stdout) ie. in the terminal or other logging mechanisms, such as a file or network connection. It takes any number of arguments and prints them out separated by spaces with a newline at the end.
Syntax
Following is the syntax of the Node.js console.info() method −
console.info(data, …args);
Parameters
This method will accept two parameters. The same are described below.
data − This parameter specifies the message that is going to be printed on the console.
args − This is an optional parameter, it holds the substitution values that will be passed to the data.
Return value
This method does not return anything; instead, it prints the formatted information to stdout in a new line similar to the console.log() method.
Example
The Node.js console.info() method works similarly to the console.log() method. This method accepts a parameter (data).
In this example, we are calling console.info() method with only a data parameter.
console.info("Welcome to tutorialspoint"); console.info("Simply Easy Learning at your fingertips");
Output
As we can see in the output, the message we passed as a data parameter is printed to stdout in a new line on the console. Similar to the console.log() method of node.js.
Welcome to tutorialspoint Simply Easy Learning at your fingertips
Example
The console.info() method of node.js will accept an optional parameter (args).
In this example, we are calling console.info() method with two parameters data and args. We are passing string values as substitution values.
console.info("Welcome to %s", "tutorialspoint"); console.info("Simply %s Learning at %s fingertips", "Easy", "your" );
Output
As we can see in the output, the message we passed as a data parameter and also substitution values in the args parameter is printed to stdout in a newline on the console.
Welcome to tutorialspoint Simply Easy Learning at your fingertips
Example
In this example, we are calling console.info() method with two parameters data and args. We are passing integer values as substitution values.
console.info("One - %d Two - %d Three - %d", 1, 2, 3); console.info("Numbers in above statement %d", 3);
Output
As we can see in the output, the message we passed as a data parameter and also the integer substitution values in the args parameter are printed to stdout in a newline on the console.
One - 1 Two - 2 Three - 3 Numbers in above statement 3
To Continue Learning Please Login
Login with Google