title: How to get nth line of a text by JavaScript?
body: <p>Consider a simple html element as</p>
  
  <pre><code>&lt;div id="test"&gt;
  a long text without line break
  &lt;/div&gt;
  </code></pre>
  
  <p>The browser will create lines based on the glyph and font sizes. After text arrangement by the browser (e.g. depending on the window width), how to get the lines of the text by <strong>JavaScript</strong>?</p>
  
  <p>For example:</p>
  
  <ol>
  <li>How to get the total number of lines </li>
  <li>How to get the first line as appeared in the current window?</li>
  <li>How to get the nth line?</li>
  </ol>