Created
February 23, 2011 16:51
-
-
Save zachwaugh/840699 to your computer and use it in GitHub Desktop.
Testing node.js console.log output string quoting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('100', 'something'); | |
console.log(100, 'something'); | |
console.log(100, 'something', 'something else'); | |
console.log(100 + ' something'); | |
console.log('something', 100, 'something'); |
Thanks!
It seems to have the same behavior with a date object as the first argument, and it was driving me nuts. Tacking on a .toString()
fixed it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running the above script displays the following output. Seems node.js will surround strings with quotes if the first argument to console.log is a number.
$ node test.js
100 something
100 'something'
100 'something' 'something else'
100 something
something 100 something