I have a unique phrase.
var phrase = "LoremipsumdolorsitametconsectetuadipiscingelitSeddoeiusmodtemporincididuntutlaboreetaliqua";
I am interested in dividing it into chunks of 11 characters starting from the end.
Currently, I use:
function splitPhrase(sentence) {
return sentence.split( /(?=(?:...........)*$)/ ).map(function(segment){return parseInt(segment)});
}
This operation results in:
[L, oremipsumd, olorsitame, tconsectet, uadipiscin, gelitSeddo, eiusmodtem, porincidun, tutlaboret, aliqua]
Queries:
How can I modify the above function to make it adaptable for breaking strings into segments of any number of characters? (I prefer not manually adding or removing dots)
Is there a way to exclude the first character when splitting the string? (I aim to maintain 'L' as the initial element so the following elements can vary in length from 1 to n)