Q : 프로그래머스 모바일은 개인정보 보호를 위해 고지서를 보낼 때 고객들의 전화번호의 일부를 가립니다.
전화번호가 문자열 phone_number로 주어졌을 때, 전화번호의 뒷 4자리를 제외한 나머지 숫자를 전부 *으로 가린 문자열을 리턴하는 함수, solution을 완성해주세요.

<script>
function solution(phone_number) {
return phone_number
.split("")
.fill("*", 0, phone_number.length - 4)
.join("");
}
</script>

<script>
const hide_num = (phone_number) => {
let result = "*".repeat(phone_number.length - 4) + phone_number.slice(-4);
return result;
};
</script>
'*'을 phone_number의 -4까지 만큼 반복시켜 변환시키셨고, 거기다가 slice 메서드를 사용해 뒤에 필요한 숫자부분을 잘라낸 것을 다시 더해주셨다.
String.prototype.repeat()
: repeat() 메서드는 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환합니다.
<script> str.repeat(count); </script>