Skip to content

Instantly share code, notes, and snippets.

@hochan222
Created August 22, 2021 09:22
Show Gist options
  • Save hochan222/821bf8751746dfaa3d548ffb9a7ca648 to your computer and use it in GitHub Desktop.
Save hochan222/821bf8751746dfaa3d548ffb9a7ca648 to your computer and use it in GitHub Desktop.
padstart
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