rfudjq
Last Updated: February 25, 2016
·
16.78K
· jsoverson

printf style formatting in console.log()

Not well known but incredibly valuable. Available in at least chrome, firefox/firebug and node.js

console.log("This prints a %s and a %d","string", 42);

3 Responses
Add your response

14789

can i pass 2 strings?

over 1 year ago ·
16178

console.log('passing %d %s is %s, even more... and it is %s too :)', 2, 'strings', 'possible', 'fun');

over 1 year ago ·
16392

%j

over 1 year ago ·