#ts-node console.log does not print strings in quotes
17 messages · Page 1 of 1 (latest)
and just to confirm, you get the quotes when logging from node directly?
Yeah, was checking that, but no. I guess I was confusing with when I am in the REPL.
Therefore, my question makes no sense.
i believe the quotes are only when they're inside structures
unrelated to whether or not you're in the repl
ah, i see what you mean
expressions vs logs, i suppose
it's probably using util.inspect here for the expressions, and console.log also uses it, but i guess not for strings since that wouldn't really help for normal logs
for example, if you had console.log("Hello world!");, should the output be Hello world! or "Hello world!"
to answer your question, console.log(util.inspect(whatever)) works
Nice, will wrap inspect in a simple wrapper for my debugging purposes.
Learned something today. Thank you both!
if it's just for debugging, you could also wrap a variable in an object to both trigger the inspect and get a label.
Yeah, I do use the object trick a lot. It does help and makes sense for discussion as well.
!resolved