How to split string to strings of equal length in JavaScript?
Dec 10, 2022 · 1 min read · Solution 'abcdabcdabcdabcdabcd'.match(/.{1,4}/g) // ['abcd', 'abcd', 'abcd', 'abcd', 'abcd'] Here's original StackOverflow answer. Context In today's Advent of Code challenge, I had to simulate drawing pixels on 40x6 CRT screen. First I computed li...
Join discussion