Function compareByX

Compares points based on x value. Y value is ignored.

Return values:

  • 0: If a.x === b.x
  • 1: a is to the right of b (ie. a.x > b.x)
  • -1: a is to the left of b (ie. a.x < b.x)
arrayOfPoints.sort(Points.compareByX);
  • Parameters

    Returns number