https://www.codewars.com/kata/57eae65a4321032ce000002d
Codewars - Achieve mastery through coding practice and developer mentorship
A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!
www.codewars.com
DESCRIPTION:
Given a string of digits, you should replace any digit below 5 with '0' and any digit 5 and above with '1'. Return the resulting string.
Note: input will never be an empty string
코드
function fakeBin(x){
return x.split('').map(el => el < 5? '0' : '1').join('');
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Reversed Words (8 kyu) / JavaScript (0) | 2023.01.21 |
---|---|
[Codewars] Reversed sequence (8 kyu) / JavaScript (0) | 2023.01.20 |
[Codewars] Reverse words (7 kyu) / JavaScript (0) | 2023.01.18 |
[Codewars] Beginner Series #1 School Paperwork (8 kyu) / JavaScript (0) | 2023.01.17 |
[Codewars] Invert values (8 kyu) / JavaScript (0) | 2023.01.16 |
댓글