sprintf.js
sprintf.js copied to clipboard
add printf()?
Maybe we could have a printf(...) which would be a wrapper to console.log(sprintf(...)), what do you guys think?
@Zorgatone it's literally one line to replicate the C printf behavior including the return value:
var printf = function() { var o = sprintf.apply(sprintf, arguments); console.log(o); return o.length; };
printf("Hello %s!", "World"); // prints 'Hello World!' to console, returns 12