Find 4 points which form a square with the biggest area
You're coding javascript the "old" way. With es6 you have a lot of new features available. Take a look at them.



Don't use self-invoking anonymous functions i.e. IIFEs

/// bad
(function(){
  // code here
})();


Use blocks

/// good
{
   // code here
}




Give meaningful names to your variables and methods. Functions should not have more than 2 parameters. If they do, you need to put them in an object.

/// bad
... pointsFormsQuadrangle = function(a, b, c, d){}

/// good
static FormsQuadrangle([point1, point2, point3, point4]){

}




Use the class syntax instead of function/prototype.

class Utils {
  static NumbersEqual(a, b){
    return Math.abs(a - b) &lt; Number.EPSILON;
  }
}

class Point {
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }

  distance(point) {
    return Math.sqrt((this.x - point.x) ** 2 + (this.y - point.y) ** 2);
  }

  equal(point) {
    return Utils.NumbersEqual(this.x, point.x) &amp;&amp; Utils.NumbersEqual(this.y, point.y);
  }

  static FormsQuadrangle(a, b, c, d) {
    if (a.equal(b) || a.equal(c) || a.equal(d)) return false;

    if (b.equal(c) || b.equal(d)) return false;

    if (c.equal(d)) return false;

    const center = new Point((a.x + b.x + c.x + d.x) / 4, (a.y + b.y + c.y + d.y) / 4);

    const ac = a.distance(center);
    const bc = b.distance(center);
    const cc = c.distance(center);
    const dc = d.distance(center);

    return Utils.NumbersEqual(ac, bc) &amp;&amp; Utils.NumbersEqual(bc, cc) &amp;&amp; Utils.NumbersEqual(cc, dc);
  }

  static FormsSquare(a, b, c, d) {
    if (!Point.FormsQuadrangle(a, b, c, d))
      return false;

    const ab = a.distance(b)
    const ac = a.distance(c);
    const ad = a.distance(d);
    const [tr1, tr2] = [ab, ac, ad].sort((a, b) =&gt; a - b);

    return Utils.NumbersEqual(tr1, tr2);
  }
}