I have this array ["Brad", "came", "to", "dinner", "with", "us"]
Brad came to dinner with us
(27 chars > 16) so I need to split it into 2 strings:
Brad came to
dinner with us
Words cannot be sliced
let inpt=["Brad", "came", "to", "dinner", "with", "us"]
op=[]
for(i of inpt) if (op.join('').length+i.length <16) {op.push(i)} else break
console.log(op.join(' '))
This return me first part but how can I get second and others if my input array(string) would be longer then 16+16+16....