반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 타입 챌린지
- 레벨 1
- dp
- 프로그래머스
- 가천대
- 소켓
- socket
- 수학
- 크롤링
- 그래프
- BFS
- typescript
- Crawling
- ip
- HTTP 완벽 가이드
- 타입스크립트
- Nestjs
- Node.js
- TCP
- 쉬운 문제
- 문자열
- dfs
- 자바스크립트
- 프로그래머스 레벨 2
- Algorithm
- type challenge
- 알고리즘
- javascript
- 백준
- HTTP
Archives
- Today
- Total
kakasoo
[node.js] 핸드폰 번호 가리기 ( 프로그래머스 레벨1 ) 본문
반응형
// 프로그래머스 레벨1 핸드폰 번호 가리기를 풀었습니다.
function solution(phone_number) {
let a, b, c, d, e;
let arr = ([a, b, c, d, ...e] = phone_number.split("").reverse());
return [e.map((el) => "*").join(""), d, c, b, a].join("");
}
구조분해할당과 나머지 연산자를 이용하면 쉽게 가능해진다.
반응형
'프로그래밍 > 알고리즘 풀이' 카테고리의 다른 글
[node.js] x만큼 간격이 있는 n개의 숫자 ( 프로그래머스 레벨1 ) (0) | 2021.06.28 |
---|---|
[node.js] 행렬의 덧셈 ( 프로그래머스 레벨1 ) (0) | 2021.06.28 |
[node.js] 하샤드 ( 프로그래머스 레벨1 ) (0) | 2021.06.28 |
[node.js] 평균 구하기 ( 프로그래머스 레벨1 ) (0) | 2021.06.26 |
[node.js] 최대 공약수와 최소 공배수 ( 프로그래머스 레벨1 ) (0) | 2021.06.26 |