DEV Community

Nikhil Chandra Roy
Nikhil Chandra Roy

Posted on

Convert console.log() to print() in javascript

So, this is just tiny post about javascript convert console.log() to print().

As a python developer it is easy to see output by doing print() so we also using print() instance of console.log() so that we don't need to write console.log() again and again.
below the codepen click JS to see the code and console for demo.

stay with me to get more post like this.
Thanks.

Top comments (2)

Collapse
 
shadowtime2000 profile image
shadowtime2000

You don't even need to do that. You can just do

const print = console.log
Enter fullscreen mode Exit fullscreen mode
Collapse
 
nikhilroy2 profile image
Nikhil Chandra Roy

yes, this also works. but. Thanks for your advice.