Created
December 18, 2016 22:45
-
-
Save MarxBro/344004e2b6f7ac1b231df19c58dcf838 to your computer and use it in GitHub Desktop.
printf on js
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
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