determine text truncate javascript

JavaScript
/**
 * Check if an element is truncated.
 */
function isTruncated(el) {
  return el.scrollWidth > el.clientWidth
}
Source

Also in JavaScript: