Dev Helpers
← Back

Find a free appointment start

Find a free appointment start using JavaScript.

Open this example in the interactive library

Source code

const busy = [
  [9, 10],
  [11, 13],
];
console.log(
  Array.from({ length: 8 }, (_, i) => i + 9).find((t) =>
    busy.every(([a, b]) => t + 1 <= a || t >= b),
  ),
);

Sample output

10