So I am really tired of writing out console.log
all of the time so I wrote a small function called clog
to pass the parameters into a console.log
.
I want to optimize this, however, that whenever I pass in a variable it should print the variable name and then the value:
clog(i) //=> i: 0
clog(myVar) //=>myVar: [1,2,3]
How would I do this?
Here's what I have currently:
const clog = (...args) => console.log(...args)