Last active
September 11, 2018 15:08
-
-
Save voidnerd/96a14c023a7e4ef2697305f6ee5c0ce2 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 encrypt(str, num) { | |
let len = str.substring(num, str.length - num).length; | |
let goin = '*'.repeat(len); | |
let res = str.slice(0, num) + goin + str.slice(str.length - num); | |
return res; | |
} | |
console.log(encrypt('111111111111111111111111111', 4)); // 1111*******************1111 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment