DEV Community

loading...

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

nikhilroy2 profile image Nikhil Chandra Roy ・1 min read

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.

Discussion (2)

pic
Editor guide
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 Author

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