Answers for "split string into equal chunks javascript"

1

split string into equal chunks javascript

var str="hello how are you"
var size=3
console.log(str.match(new RegExp('.{1,' + size + '}', 'g')))
//returns ["hel","lo ","how"," ar","e y","ou"]
Posted by: Guest on June-14-2021

Code answers related to "split string into equal chunks javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language