Created
June 1, 2018 12:57
-
-
Save jan-osch/6d2682ac43629521e61993de9fb3e954 to your computer and use it in GitHub Desktop.
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 * dawejPadding(str, len, ch=' '){ | |
let current = str.length; | |
while(current < len){ | |
yield ch; | |
current++; | |
} | |
yield str; | |
} | |
const printuj = (subject) => { | |
for(const c of subject){ | |
process.stdout.write(c); | |
} | |
process.stdout.write('\n') | |
} | |
const leftLepszyPad = (str, len, ch=' ')=>{ | |
const missing = len - str.length; | |
return `${new Array(missing).fill(ch).join('')}${str}` | |
} | |
const DUZO = 400000000 | |
// printuj(leftLepszyPad('kuku', 100000000, 'X')) | |
printuj(leftPad('kuku', DUZO, 'X')) | |
printuj(dawejPadding('kuku', DUZO, 'X')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment