Created
August 31, 2016 18:09
-
-
Save gskema/858a5c10bf46fe64a1f994f633e64c6e to your computer and use it in GitHub Desktop.
Left pad JavaScript string
This file contains hidden or 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
export function lpad(pad, string) { | |
var trueString = '' + string; | |
return pad.substring(0, pad.length - trueString.length) + trueString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment