Created
September 9, 2017 18:36
-
-
Save sespinosa/685382bf444065b8e4e8cf033c2f9dd6 to your computer and use it in GitHub Desktop.
addWhiteSpace at the end function
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
function addWhiteSpaceAtTheEnd(str, len) { | |
if(str.length >= len) return str; | |
var delta = len - str.length; | |
var res = str; | |
for(var i = 0 ; i < delta ; i++) { | |
res = res + " "; | |
} | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment