티스토리 뷰
나중에 잘 사용할 것 같은데 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
- styled component 조건부 사용방법
- 별점만들기
- nextjs 토큰 만료처리하기
- 에러모음집
- 유효성검사 css
- Fetch와 Axios 의 장단점
- 별점 색채우기
- Warning: validateDOMNesting(...): <li> cannot appear as a descendant of <li>
- axiosinstance 사용 시 토큰 사용 법
- styled component GlobalStyle 사용방법
- styled component 사용방법
- readme 작성해야 하는 이유
- axios instance 작성하기
- styled component 설치방법
- Warning: Each child in a list should have a unique "key" prop.
- simple Icon 사용방법
- 영화별점만들기
- git cache
- Warning: A component is changing an uncontrolled input to be controlled.
- 유효성검사
- readme 이미지 추가 방법
- readme작성해보기
- 영화 별점
- readme 역할
- readme 작성 방법
- axios 사용하기
- axios 설치하기
- axios CRUD
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함