Answers for "truncate text in javascript"

4

How to make string shorter javascript

const string = "Name".slice(0, 250).concat('...');
const string2 = "Name".substring(0, 250).concat('...');
Posted by: Guest on February-22-2020
4

javascript truncate string

var string = "ABCDEFG";
var truncString = string.substring(0, 3); //Only keep the first 3 characters
console.log(truncString); //output: "ABC"
Posted by: Guest on May-20-2020
1

determine text truncate javascript

/**
 * Check if an element is truncated.
 */
function isTruncated(el) {
  return el.scrollWidth > el.clientWidth
}
Posted by: Guest on November-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language