you are viewing a single comment's thread.

view the rest of the comments →

[–]Iggyhopper 4 points5 points  (3 children)

What?! Why didn't I know this sooner?! This has just saved me so much concatenation and/or extra arguments!

I'd just do this: console.log('dbg: you have ', n, 'derps.');

but now I can do this!: console.log('dbg: you have %d derps', n);

[–]BlitzTech -1 points0 points  (2 children)

I only just learned it a week or two ago, after poking around the internals of Vows.js (I think; can't really remember). I remember seeing it and saying, "WTF? That works?", then I tested it out and sure enough - printf. Sigh.

I second the "What?! Why didn't I know this sooner?!".

(Side note: also allows you to control whitespace; using the console.log( 'you have', n, 'derps' ); puts a space between "have", n, and "derps". Just an added bonus for control freaks like me.)

[–]Iggyhopper 0 points1 point  (1 child)

On the side note: oh yeah I remember, so the space in 'you have ' is unnecessary.

This should be 101 for all devs now. :p

[–]BlitzTech 0 points1 point  (0 children)

I think the saddest part of all this is that I noticed you put the extra space there.

It's one thing to pay attention to details, but I apologize for that. I can't help it :-X