JSFiddle - React, Tailwind, and code Playground

split long string with '...'

by Trina Lu

JavaScript

function spilt_word(_str,_length){
	return (_str.length <= _length) ? _str : _str.substr(0,_length) + '...';
}

console.log(spilt_word('i_am_a_super_long_string!',10));