I need a method to split a string into an array of smaller strings, spliting it by word count. It is, I'm looking for a function like that:
function cut(long_string, number_of_words) { ... }
var str = "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12";
var arr = cut(str, 3);
In this case, cut should return 4 arrays with 3 words each. I've tried to figure out a regex for String.match() or String.split(), but I don't know how to do it..