티스토리 뷰
나중에 잘 사용할 것 같은데 repeat라는 매서드를 처음 알게되어 메모하고자 TIL 작성!!
문제는 다음과 같다.

repeat매서드와 slice 함수를 사용해 만들어 주었다.
repeat () 매서드
문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환한다.
repeat () 매서드 사용방법
str.repeat(count);
" A.repeat(3) = AAA " 아주 쉽쥬?
그래서 내가 작성한 코드는 다음과 같다.
function solution(phone_number) {
return '*'.repeat(phone_number.length-4)+phone_number.slice(-4)
}'Programmers' 카테고리의 다른 글
| 문자열 내림차순으로 배치하기 (0) | 2024.02.16 |
|---|---|
| 2024.02.07 내적 (0) | 2024.02.07 |
| 2024. 02. 06 가운데 글자 가져오기 (1) | 2024.02.06 |
| 2024. 02 . 02 👩💻 없는 숫자 더하기 👩💻 (0) | 2024.02.02 |
| 2024. 01. 23 프로그래머스 하샤드 수 (0) | 2024.01.23 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- axios instance 작성하기
- axiosinstance 사용 시 토큰 사용 법
- styled component 사용방법
- axios CRUD
- axios 사용하기
- readme작성해보기
- 반려동물일자리
- 부업추천
- readme 작성해야 하는 이유
- 프리케시
- simple Icon 사용방법
- styled component 설치방법
- readme 이미지 추가 방법
- 도그워커구인
- readme 작성 방법
- styled component 조건부 사용방법
- Warning: Each child in a list should have a unique "key" prop.
- axios 설치하기
- 프리캐시후기
- 모바일게임부업
- 에러모음집
- 에우다
- Fetch와 Axios 의 장단점
- 펫시터구인
- Warning: A component is changing an uncontrolled input to be controlled.
- Warning: validateDOMNesting(...): <li> cannot appear as a descendant of <li>
- freecash
- nextjs 토큰 만료처리하기
- styled component GlobalStyle 사용방법
- readme 역할
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
글 보관함
