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
- custom hook
- TypeScript
- TABLESPACE
- descendingOrder
- isSquare
- react
- java api
- JDBC
- react hook
- codewar
- manifest.json
- IBM
- DB2
- Debug
- codewars
- type
- useEffect
Archives
- Today
- Total
taesik
persistence function that takes in a positive parameter num and returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit. 본문
functions and trick/typescript_javascript
persistence function that takes in a positive parameter num and returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit.
taesikk 2022. 1. 24. 20:19my solution :
const persistence = num => {
return `${num}`.length > 1
? 1 + persistence(`${num}`.split('').reduce((a, b) => a * +b))
: 0;
}
const persistence = num => {
return `${num}`.length > 1
? 1 + persistence(`${num}`.split('').reduce((a, b) => a * +b))
: 0;
}'functions and trick > typescript_javascript' 카테고리의 다른 글
| isAscending (0) | 2022.01.25 |
|---|---|
| diamond with * (0) | 2022.01.24 |
| 2D array of number. to find the sum of minimum value in each row. (0) | 2022.01.24 |
| has the same amount of 'x's and 'o's. (0) | 2022.01.23 |
| contain_all_rotation (0) | 2022.01.23 |