(1) reduce 사용
function solution(cipher, code) {
return [...cipher.split('')].reduce((result, char, idx) => { return result = (idx+1) % code === 0 ? result += char : result }, '')
}
(2) filter 사용
function solution(cipher, code) {
return [...cipher.split('')].filter((char, idx) => (idx+1) % code === 0 ).join('')
}
const solution = (cipher, code) => [...cipher].filter((a,i) => (i+1)%code === 0).join("")