I was reading the docs for console.log(), when I noticed the syntax:
console.log(obj1 [, obj2, ..., objN]);
console.log(msg [, subst1, ..., substN]);
Huh? I’m aware that you can pass multiple values to console.log()
(the first syntax), but you can also do substitutions?
The docs pointed to this page: https://developer.mozilla.org/en-US/docs/Web/API/console#Outputting_text_to_the_console
So I tried it and, yes, you can use string substitutions on console.log
, almost C/Java-like.
You can even style them
You can also stack-trace! (ok, this is not console.log
, but it’s close)