Description:
Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct.
However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we mask it. Your task is to write a function maskify, which changes all but the last four characters into '#'.
Examples
maskify("4556364607935616") == "############5616"
maskify( "64607935616") == "#######5616"
maskify( "1") == "1"
maskify( "") == ""
// "What was the name of your first pet?"
maskify("Skippy") == "##ippy"
maskify("Nananananananananananananananana Batman!") == "####################################man!"
아래는 개선된 코드입니다.
'Computer science > 알고리즘' 카테고리의 다른 글
[자바스크립트로 구현한 알고리즘] Find the next perfect square! (0) | 2016.09.21 |
---|---|
[자바스크립트로 구현한 알고리즘] Isograms (0) | 2016.09.20 |
[자바스크립트로 구현한 알고리즘] Descending Order (0) | 2016.09.20 |
[자바스크립트로 구현한 알고리즘] Vowel Count (0) | 2016.09.19 |
[자바스크립트로 구현한 알고리즘] Mumbling (0) | 2016.09.19 |
이 포스팅은 쿠팡파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.