Tuesday, 2 October 2018

node.js: console.log([data][, ...args]): logs the message

console.log([data][, ...args])
It logs the message to stdout with new line. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values.

HelloWorld.js
console.log("User '%s' login failed", "Krishna");
console.log("Please retry after some time");
console.log("If you forgot the password, please contact administrator");


Output
User 'Krishna' login failed
Please retry after some time
If you forgot the password, please contact administrator




Previous                                                 Next                                                 Home

No comments:

Post a Comment