diff --git a/contents/count-how-many-lines-a-given-string-takes-up-in-a-text-area.mdx b/contents/count-how-many-lines-a-given-string-takes-up-in-a-text-area.mdx index 8edba97..0c45173 100644 --- a/contents/count-how-many-lines-a-given-string-takes-up-in-a-text-area.mdx +++ b/contents/count-how-many-lines-a-given-string-takes-up-in-a-text-area.mdx @@ -175,7 +175,7 @@ document.addEventListener('DOMContentLoaded', () => { lineCount++; } - return lineCount; + return lineCount + str.split(/\r\n|\r|\n/).length - 1; }; const ro = new ResizeObserver(() => {