title: Test if two lines intersect - JavaScript function
body: <p>I've tried searching for a javascript function that will detect if two lines intersect each other.</p>
  
  <p>The function will take the x,y values of both the start end points for each line (we'll call them line A and line B).</p>
  
  <p>Is to return true if they intersect, otherwise false. </p>
  
  <p>Example of the function. I'm happy if the answer uses a vector object instead. </p>
  
  <pre><code>Function isIntersect (lineAp1x, lineAp1y, lineAp2x, lineAp2y, lineBp1x, lineBp1y, lineBp2x, lineBp2y) 
  {
  
      // JavaScript line intersecting test here. 
  
  }
  </code></pre>
  
  <p>Some background info: this code is for a game I'm trying to make in html5 canvas, and is part of my collision detection.</p>