Created
August 22, 2021 09:22
-
-
Save hochan222/821bf8751746dfaa3d548ffb9a7ca648 to your computer and use it in GitHub Desktop.
padstart
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
const padStart = (targetLength: number, padString: string, str: string): string => { | |
return str.length >= targetLength ? str : new Array(targetLength - str.length + 1).join(padString) + str; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment