DEV Community

Discussion on: JavaScript Katas: Split In Parts

Collapse
 
kosich profile image
Kostia Palchyk • Edited

Okay, this one is easy enough for me..

const splitInParts =
  (s, n) => s.replace(new RegExp(`.{${n}}`, 'g'), '$& ')