Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript truncate with ellipsis

function truncate_with_ellipsis(s,maxLength) {
   if (s.length > maxLength) {
      return s.substring(0, maxLength) + '...';
   }
   return s;
};
alert(truncate_with_ellipsis("hello how are you today?",9));//hello how...
Comment

PREVIOUS NEXT
Code Example
Javascript :: react split array into chunks 
Javascript :: javascript remove last character from string 
Javascript :: terminate execution in jquery 
Javascript :: fs file already exists 
Javascript :: javascript loop through arrya 
Javascript :: canvas full screen js 
Javascript :: onclick cloSe tab in jquery 
Javascript :: how to remove id in jquery 
Javascript :: loop through object and get a certain values 
Javascript :: npm install the exact package version specified in package.json 
Javascript :: how to get first and last name from email js regex 
Javascript :: javascript make beep sound 
Javascript :: replace globally in javascript 
Javascript :: array to comma separated list js 
Javascript :: alphabetical order array javascript 
Javascript :: js conditional object property 
Javascript :: create slug in javascript 
Javascript :: google maps infowindow on hover 
Javascript :: document ready without jquery 
Javascript :: parsley cdn 
Javascript :: react or vue 
Javascript :: javascript remove space from string 
Javascript :: tabe close alert in js 
Javascript :: react native object is empty 
Javascript :: fs.writefile 
Javascript :: how to call a function with a button in javascript 
Javascript :: loop json object android java 
Javascript :: refreshing a page with jquery 
Javascript :: javascript date today dd mm yyyy 
Javascript :: delete parent element javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =