Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Cut Sentence by Moff
function cutSentence(line, length) {
let words = line.split(' ');
let result = '...';
for (let i = 1; i < words.length; i++) {
let res = words.slice(0, i).join(' ');
if (res.length <= length) {
result = res + '...';
} else {
return result;
}
}
return line;
}
July 21, 2017