JSFiddle - React, Tailwind, and code Playground
by serio
JavaScript
var str = "Lorizzle ipsum dolizzle dang amizzle, consectetuer adipiscing yo mamma. Nullizzle sapizzle velit, dawg volutpizzle, crunk quis, gravida vizzle, arcu. Pellentesque stuff tortor. Sed eros. I saw beyonces tizzles and my pizzle went crizzle shizzle my nizzle crocodizzle phat dapibizzle turpis tempizzle fo shizzle my nizzle. Maurizzle pellentesque check it out et turpis. Gangsta izzle tortizzle. Pellentesque ass rhoncus nisi. In hizzle habitasse platea mah nizzle. I saw beyonces tizzles and my pizzle went crizzle dapibizzle. Curabitizzle tellus sizzle, pretium eu, fo shizzle my nizzle own yo', eleifend vitae, nunc. My shizz suscipizzle. We gonna chung sempizzle velit dawg purizzle.";
function trunc( str, n )
{
return str.substr( 0, n -1 ) + ( str.length > n ? '...' : '' );
};
alert( trunc( str, 50 ) );