docs: function binSearch2(xs, pred) {
        var a, b, mid;
  
        a = -1;
        b = xs.length - 1;
        while (b - a > 1) {
           mid = Math.floor((a + b) / 2);
           if (pred(xs[mid])) {
              b = mid;
           } else {
              a = mid;
           }
        }
        return b;
  
     }