JSFiddle - React, Tailwind, and code Playground

HTML

<p>Текст, который необходимо сократить</p>

JavaScript

$(document).ready(function(){ 
    resultString = cutText($('p').text(), 12);    
    $('p').append('<p style = "color:red">'+resultString+'</p>')
});

function cutText(text, len){
    while(len <= text.length)
        if(text[++len]===' ') break;    
    return text.substring(0, len)+'...';
}