nodejs console.log code example

Example 1: console.log javascript

console.log(10);
console.log('You can also log numbers')

Example 2: javascript console.log

console.log('I want to log this so I am logging this. Calm down and log.')

Example 3: print in node js

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to stderr

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example 4: nodejs console.log

console.log("hello world");

Tags:

Java Example