Skip to content

Instantly share code, notes, and snippets.

@MarxBro
Created December 18, 2016 22:45
Show Gist options
  • Save MarxBro/344004e2b6f7ac1b231df19c58dcf838 to your computer and use it in GitHub Desktop.
Save MarxBro/344004e2b6f7ac1b231df19c58dcf838 to your computer and use it in GitHub Desktop.
printf on js
function printf(fmt){
var strings = fmt.split(/[%].?/), string=strings[0];
for(let i=1; i<strings.length; i++){
string+=arguments[i]+strings[i];
}
console.log(string);
return string.length
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment