javascript max length with elipsis

Solutions on MaxInterview for javascript max length with elipsis by the best coders in the world

showing results for - "javascript max length with elipsis"
Lee
17 Jul 2018
1function truncate_with_ellipsis(s,maxLength) {
2   if (s.length > maxLength) {
3      return s.substring(0, maxLength) + '...';
4   }
5   return s;
6};
7alert(truncate_with_ellipsis("hello how are you today?",9));//hello how...