DEV Community


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.

Discussion (2)

shadowtime2000 profile image

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

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

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

Forem Open with the Forem app