trim method jquery code example
Example 1: javascript remove all whitespaces
var spacesString= "Do I have spaces?";
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
Example 2: trim text and add ... js
const truncate = (input) => input.length > 5 ? `${input.substring(0, 5)}...` : input;