_:nf509453867764904a2c6488bdd1ff89bxb13
<http://schema.org/text>
"<p>Help I can't find the error</p>\n\n<p>export const shortenByWords = (s, n) =&gt; {<br>\n  if(s.legth &gt; n) {<br>\n    for(let i = n + 1; i &gt;= 0; i--) {<br>\n      if(s<i> === ' '){<br>\n        return s.slice(0, i) + '...'<br>\n      }<br>\n    }<br>\n  } else {<br>\n    return s<br>\n  }<br>\n}<br>\n</i></p>"
<https://en.coderslang.com/d/154-task-145-shortenbywords>