隆Te damos la bienvenida a este reto!

1

隆Bienvenido al mundo de JavaScript!

D铆a 1

2

Variables, funciones y sintaxis b谩sica

3

Tipos de datos

4

Playground - Retorna el tipo

5

Tipos de datos - pt 2

D铆a 2

6

Operadores

7

Hoisting y coerci贸n

8

Playground - Calcula la propina

9

Alcance de las variables

D铆a 3

10

Condicionales

11

Playground - Calcula a帽os bisiestos

12

Switch

13

Playground - Obten informaci贸n de mascotas seg煤n su tipo

14

Ciclos

15

Playground - Dibuja un triangulo

D铆a 4

16

Arrays

17

Playground - Encuentra al michi mas famoso

18

Objetos

19

Playground - Obten el promedio de los estudiantes

D铆a 5 - Checkpoint

20

Playground - encuentra el palindromo m谩s grande

D铆a 6

21

Reasignaci贸n y redeclaraci贸n

22

Modo estricto

D铆a 7

23

Debugging y manejo de errores

24

Programaci贸n funcional

Quiz: D铆a 7

D铆a 8

25

Closures

26

Playground - Crea una calculadora con closures

27

Higher order functions

28

Playground - Crea tu propio m茅todo map

D铆a 9

29

ECMAScript

30

TC39

Quiz: D铆a 9

D铆a 10 - Checkpoint

31

ES6

32

ES7

33

Playground - Task planner

D铆a 11

34

Asincronismo

35

Playground - Promesas

36

Manejando el asincronismo

37

Playground - Resuelve el callback hell usando promesas

38

Playground - Resuelve el callback hell usando async/await

D铆a 12

39

Arrays a profundidad

40

M茅todos de arrays: Every, Find y findIndex

41

Playground - V谩lida el formulario

D铆a 13

42

M茅todos de arrays: Includes, Join y concat

43

Playground - agrupa los productos

44

M茅todos de arrays: Flat y FlatMap

45

Playground - Encuentra la ubicaci贸n del valor buscado

D铆a 14

46

Mutable functions

47

Playground - Modifica una lista de compras

48

M茅todos de arrays: sort

49

Playground - Ordena los productos

D铆a 15 - Checkpoint

50

Playground - Sistema de reservaciones de un hotel

D铆a 16

51

Programaci贸n orientada a objetos en JavaScript

52

Objetos literales

53

Playground - Congela el objeto recursivamente

D铆a 17

54

Prototipos en JavaScript

55

Playground - Modifica el prototype de los arrays

56

Playground - Crea un auto usando clases

D铆a 18

57

Abstracci贸n en JavaScript

58

Playground - Sistema de carrito de compras

59

Encapsulamiento en JavaScript

60

Playground - Encapsula datos de los usuarios

D铆a 19

61

Herencia en JavaScript

62

Playground - Jerarqu铆a de animales

63

Polimorfismo en JavaScript

64

Playground - Sistema de pagos

D铆a 20 - Checkpoint

65

Playground - Agenda de vuelos

Live Class

66

30 d铆as de JS con Juan DC

67

30 d铆as de JS con Nicobytes

No tienes acceso a esta clase

隆Contin煤a aprendiendo! 脷nete y comienza a potenciar tu carrera

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Reg铆strate

Comienza en:

3D
20H
13M
6S

Playground - Sistema de reservaciones de un hotel

50/67

Aportes 28

Preguntas 2

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad?

o inicia sesi贸n.

MI SOLUCION 馃挭
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  const reserv = [];
  return {
    searchReservation: id => {
      const res = reserv.find(reserve => reserve.id === id);
      if (res) return res;
      else throw new Error("La reservaci贸n no fue encontrada");
    },
    getSortReservations: () => {
      return [...reserv].sort((reserve1, reserve2) => {
        if (reserve1.checkIn > reserve2.checkIn) return 1;
        if (reserve1.checkIn < reserve2.checkIn) return -1;
        if (reserve1.checkIn === reserve2.checkIn) return 0;
      });
    },
    addReservation: reservation => {
      if (reservation.checkIn > reservation.checkOut) {
        throw new Error("La fecha de llegada no puede ser despu茅s de la salida");
      }
      const isRoomReserved = reserv.filter(reserve =>
            reserve.checkIn <= reservation.checkOut &&
            reserve.checkOut >= reservation.checkIn
          ).some(reserve =>
            reserve.roomNumber === reservation.roomNumber
          );
      if (isRoomReserved) throw new Error("La habitaci贸n no est谩 disponible");
      reserv.push(reservation);
      return "Reservaci贸n registrada exitosamente";
    },
    removeReservation: id => {
      const index = reserv.findIndex(reserve => reserve.id === id);
      if (index === -1) throw new Error("La reservaci贸n que se busca remover no existe");
      return reserv.splice(index,1)[0];
    },
    getReservations: () => reserv,
    getAvailableRooms: (checkIn, checkOut) => {
      const availableRooms = [];
      let index = 0;
      for (let i = 0; i < rooms; i++) {
        availableRooms[i] = i + 1;
      }
      reserv.filter(reserve =>
        reserve.checkIn <= checkOut &&
        reserve.checkOut >= checkIn
      ).forEach(reserve => {
        index = availableRooms.findIndex(num => reserve.roomNumber === num);
        if (index != -1) availableRooms.splice(index, 1);
      });
      return availableRooms;
    }
  }
}

Soluci贸n鈥 馃槃
.
Por fin se logr贸鈥 馃槄.
.
Para la realizaci贸n del reto es importante convertir fechas en String a objetos de fecha Date. Puede realizarse de la siguiente manera:
.

// donde 'date' es un string en formato dd/mm
new Date(`${date} ${new Date().getFullYear()}`)

.
Cuando queremos saber si una habitaci贸n no es disponible, debemos recorrer toda la lista de reservas 鈥榬eserva actual鈥 y comparar los checkIn y checkOut de estas con los de la reserva que queremos realizar 鈥榬eserva鈥.
.
Las condiciones son las siguientes:
.

.
Por lo que si alguna de estas se cumple, debemos verificar si el n煤mero de la habitaci贸n corresponde al de la reserva que queremos realizar. Si cumple significa que la habitaci贸n no es disponible, caso contrario al no cumplirse ninguna de las primeras 3 condiciones, la habitaci贸n es disponible.
.
C贸digo:
.

export function hotelSystem(rooms) {
  let roomList = [];

  // Buscar reserva por id
  function searchReservation(id) {
    let foundRoom = roomList.find((room) => room.id === id);
    if (foundRoom) {
      return foundRoom;
    }
    throw new Error("La reservaci贸n no fue encontrada");
  }

  // Ordenar reservas
  function getSortReservations() {
    let sortedRooms = [...roomList].sort((a, b) => {
      let dateA = convertToDate(a.checkIn);
      let dateB = convertToDate(b.checkIn);
      return dateA - dateB;
    });
    return sortedRooms;
  }

  // Convertir a fechas
  function convertToDate(date) {
    return new Date(`${date} ${new Date().getFullYear()}`);
  }

  // Agregar reserva
  function addReservation(reservation) {
    if (!isAvailable(reservation)) {
      throw new Error("La habitaci贸n no est谩 disponible");
    }

    roomList.push(reservation);
    return 'Reserva exitosa';
  }

  // Verificar si la habitaci贸n est谩 disponible
  function isAvailable(reservation) {
    let resIn = reservation.checkIn;
    let resOut = reservation.checkOut;

    for (let actRes of roomList) {
      let actCheckIn = actRes.checkIn;
      let actCheckOut = actRes.checkIn;

      if (
        (resIn >= actCheckIn && resIn < actCheckOut)
        ||
        (resOut > actCheckIn && resOut <= actCheckOut)
        ||
        (resIn <= actCheckIn && resOut >= actCheckOut)
      ) {
        if (actRes.roomNumber === reservation.roomNumber) {
          return false;
        }
      }
    }
    return true;
  }

  // Remover reserva por id
  function removeReservation(id) {
    let index = roomList.findIndex((room) => room.id === id);
    if (index > -1) {
      return roomList.splice(index, 1)[0];
    } else {
      throw new Error("La reservaci贸n que se busca remover no existe");
    }
  }

  // Retornamos todas las reservas
  function getReservations() {
    return roomList;
  }

  // Retornar las habitaciones disponibles
  function getAvailableRooms(checkIn, checkOut) {
    let availableRooms = [];

    for (let i = 1; i <= rooms; i++) {
      let reservation = { checkIn, checkOut, roomNumber: i };

      if (isAvailable(reservation)) {
        availableRooms.push(i);
      }
    }

    return availableRooms;
  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  };
}
export function hotelSystem(rooms) {

  let reservations = []

  const _rooms = new Array(rooms)
  for (let i = 0; i < _rooms.length; i++) _rooms[i] = i + 1

  const dateToNumber = (date) => {
    const currentYear = new Date().getFullYear().toString()
    return new Date(date + '/' + currentYear).getTime()
  }

  const occupiedRooms = (checkIn,checkOut) => reservations.filter(r =>
    dateToNumber(checkOut) > dateToNumber(r.checkIn) ||
    dateToNumber(checkIn) < dateToNumber(r.checkOut)
  ).map(r => r.roomNumber)


  // Tu c贸digo aqu铆
  return {
    searchReservation(id) {
      const reservation = reservations.find(r => r.id === id)
      if (!reservation) throw new Error("La reservaci贸n no fue encontrada")

      return reservation
    },
    getSortReservations() {
      return [...reservations].sort((a, b) => dateToNumber(a.checkIn) - dateToNumber(b.checkIn))
    },
    addReservation(reservation) {
      const roomAvailable = !occupiedRooms(reservation.checkIn, reservation.checkOut).includes(reservation.roomNumber)

      if (!roomAvailable) throw new Error("La habitaci贸n no est谩 disponible")
      reservations.push(reservation)

      return "La habitaci贸n se creo correctamente"
    },
    removeReservation(id) {
      const reservation = this.searchReservation(id)
      reservations = reservations.filter(r => r.id !== id)
      return reservation
    },
    getReservations() {
      return reservations
    },
    getAvailableRooms(checkIn, checkOut) {
      return _rooms.filter(room => !(occupiedRooms(checkIn,checkOut).includes(room)))
    }
  }
}

Este es mi aporte, aunque un poco tarde pero lo hice, con un poco de ayuda, gracias Leo
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  // Tu c贸digo aqu铆
  let resRoom = [];

  function available(reservation) {
    const roomReserv = resRoom.filter(rm => reservation.checkIn >= rm.checkIn && reservation.checkIn <= rm.checkOut || reservation.checkOut >= rm.checkIn && reservation.checkOut <= rm.checkOut).some(rm => rm.roomNumber === reservation.roomNumber);
    return roomReserv;
  }

  function seekReservation(id) {
    const reservation = resRoom.find(res => res.id === id);
    return reservation;
  }

  return {
    searchReservation(id) {
      const reservation = seekReservation(id);
      if (reservation)
        return reservation;
      else throw new Error('La reservaci贸n no fue encontrada');
    },
    getSortReservations() {
      return [...resRoom].sort((ra, rb) => {
        if (ra.checkIn > rb.checkIn) return 1;
        if (ra.checkIn < rb.checkIn) return -1;
        if (ra.checkIn = rb.checkIn) return 0;
      });
    },
    addReservation(reservation) {
      if (available(reservation)) {
        throw new Error('La habitaci贸n no est谩 disponible');
      } else {
        resRoom.push(reservation);
        return 'La reservacion se realizo con exito';
      }
    },
    removeReservation(id) {
      const reservation = seekReservation(id);
      if (reservation) {
        resRoom = resRoom.filter(res => res.id !== id);
        return reservation;
      } else throw new Error('La reservaci贸n que se busca remover no existe');
    },
    getReservations() {
      return resRoom;
    },
    getAvailableRooms(checkIn, checkOut) {
      let availableRooms = [];
      for (let i = 1; i <= rooms; i++) {
        let reserv = { checkIn, checkOut, roomNumber: i };
        if (!available(reserv)) {
          availableRooms.push(i);
        }
      }
      return availableRooms;
    }
  }
}

Aqu铆 mi soluci贸n:
.
.
.
.
.
.
.
.
.
.
.

function hotelSystem(rooms){
  let reservations = [];
  let room = [];
  for (let i=1; i<= rooms; i++){
    room.push(i);
  }

  //funcion para convertir a fecha 
  function getfecha(valor){
    let date  = new Date();
    let sday   = valor.substring(0,2)
    let smonth = valor.substring(3)
    let sdate = date.getFullYear()+"/"+smonth+"/"+sday;
    let ddate = new Date(sdate);
    return ddate;
  }

  return {
    searchReservation(id){
      //busco una reservacion por su id
      let reservation =  reservations.find(elem => elem.id === id );
      if (reservation) {
        return reservation;
      } else {
        throw new Error("La reservaci贸n no fue encontrada");        
      }
    },
    getSortReservations(){
      return structuredClone(reservations).sort((a, b) => getfecha(a.checkIn).getTime() - getfecha(b.checkIn).getTime());
    },
    addReservation(reservation){
      let li_index = room.findIndex(item => item === reservation.roomNumber)
      if (li_index === -1){
        throw new Error("El n煤mero de habitaci贸n no correcta");
      }
      //filtro las reservaciones x numero de habitaci贸n
      let searchreservation =  reservations.filter(elem => elem.roomNumber === reservation.roomNumber );
      if (searchreservation.length > 0 ) {
        //filtro seg煤n las fechas solicitadas
        let searchdate = searchreservation.filter(elem => (getfecha(elem.checkIn).getTime() < getfecha(reservation.checkOut).getTime()) || (getfecha(elem.checkOut).getTime() < getfecha(reservation.checkIn).getTime()));
        if (searchdate.length > 0){
          throw new Error("La habitaci贸n no est谩 disponible");
        }
      } 
      reservations.push(reservation);
      return "Se registr贸 la reservaci贸n."
    },
    removeReservation(id){
      //busco una reservaci贸n por id y encuentro su index
      let li_index = reservations.findIndex(elem => elem.id === id);
      if (li_index === -1) {
        throw new Error("La reservaci贸n no existe.");
      }
      //obtento la reservaci贸n por su id
      let reservation = reservations.find(elem => elem.id === id);
      reservations.splice(li_index,1);
      return reservation;            
    },
    getReservations(){
      return reservations;
    },
    getAvailableRooms(checkIn, checkOut){
      let free = [];
      for (let i=0; i<room.length; i++){
        let searchroom = reservations.filter(elem => elem.roomNumber === room[i]);
        let li_find = searchroom.findIndex(elem => (getfecha(elem.checkIn).getTime() >= getfecha(checkIn).getTime()) || (getfecha(elem.checkOut).getTime() <= getfecha(checkOut).getTime()));
        if (li_find === -1){       
          free.push(room[i])
        }
      }
      return free;
    }
  }
} 

Spoiler

Definitivamente mas complejo que los otros playgrounds, espero con mucha emoci贸n los 15 proximos dias de desafios 馃槂

Adjunto mi soluci贸n y un perrito antispoilers

export function hotelSystem(rooms) {
  // Tu c贸digo aqu铆
  let reservations = [];
  function searchReservation(id) {
    const exist = reservations.some((reservation) => reservation.id == id);
    if (!exist) {
      throw new Error("La reservaci贸n no fue encontrada");
    }
    return reservations.find((res) => res.id == id);
  }

  function getSortReservations() {
    const result = [...reservations];
    result.sort((a, b) => {
      let date1 = a.checkIn.split("/");
      let date2 = b.checkIn.split("/");
      date1 = new Date(2023, date1[1] - 1, date1[0]).getTime();
      date2 = new Date(2023, date2[1] - 1, date2[0]).getTime();

      return date1 - date2;
    });
    return result;
  }

  function addReservation(reservation) {
    const hasReservation = reservations.some(
      (element) => element.roomNumber == reservation.roomNumber
    );
    if (!hasReservation) {
      reservations.push(reservation);
      return `La reservaci贸n de ${reservation.name} fue agendada exitosamente`;
    }

    const checkIn = convertDate(reservation.checkIn);
    const checkOut = convertDate(reservation.checkOut);

    reservations.forEach((el) => {
      const elCheckIn = convertDate(el.checkIn);
      const elCheckOut = convertDate(el.checkOut);

      const ocupped = isOcupped(elCheckIn, elCheckOut, checkIn, checkOut);

      if (ocupped) {
        throw new Error("La habitaci贸n no est谩 disponible");
      } else {
        reservations.push(reservation);
      }
    });
    return `La reservaci贸n de ${reservation.name} fue agendada exitosamente`;;
  }

  function removeReservation(id) {
    const exist = reservations.some((reservation) => reservation.id == id);
    if (!exist) {
      throw new Error("La reservaci贸n que se busca remover no existe");
    }
    const toDelete = reservations.find(el=> el.id == id)
    reservations = reservations.filter((reservation) => reservation.id != id);
    return toDelete;
  }

  function getReservations() {
    return reservations;
  }

  function getAvailableRooms(checkIn, checkOut) {
    const result = [];
    checkIn = convertDate(checkIn);
    checkOut = convertDate(checkOut);

    for (let i = 1; i <= rooms; i++) {
      const roomTaken = reservations.some((el) => el.roomNumber == i);
      if (!roomTaken) {
        result.push(i);
      } else {
        const filtered = reservations.filter((el) => el.roomNumber == i);
        const occuped = filtered.some((el) => {
          const elCheckIn = convertDate(el.checkIn);
          const elCheckOut = convertDate(el.checkOut);
          return isOcupped(elCheckIn, elCheckOut, checkIn, checkOut);
        });
        if (!occuped) {
          result.push(i);
        }
      }
    }
    return result;
  }

  function convertDate(date) {
    let convertedDate = date.split("/");
    convertedDate = new Date(
      2023,
      convertedDate[1] - 1,
      convertedDate[0]
    ).getTime();
    return convertedDate;
  }

  function isOcupped(checkIn1, checkOut1, checkIn2, checkOut2) {
    return (
      (checkIn1 <= checkOut2 && checkOut1 >= checkOut2) ||
      (checkIn1 <= checkIn2 && checkOut1 >= checkIn2)
    );
  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms,
  };
}

Mi soluci贸n con sus detalles鈥 馃槂

function hotelSystem(length) {
  // Tu c贸digo aqu铆
  console.log("---".repeat(100));
  const totalrooms = [];

  function findroom(prop, data, arr) {
    let search;

    for (let i of arr) {
      for (let j in i) {
        if (i[j] == data && j === prop) {
          search = i;
        }
      }

    }
    return search;
  }

  function modDate(check) {

    let upCheck = check.split("/").reverse();

    const year = String((new Date()).getFullYear());
    upCheck.push(year);
    const time = (new Date(upCheck.join("/"))).getTime()
    return time;
  }

  function searchReservation(id) {
    let searchreserv = findroom("id", id, totalrooms);

    if (!searchreserv) {
      throw new Error("La reservaci贸n no fue encontrada");

    } else {
      return searchreserv;
    }
  }
  function getSortReservations() {
    return [...totalrooms].sort((a, b) => modDate(a.checkIn) - modDate(b.checkIn));
  }

  function addReservation(reservation) {

    if (totalrooms.length > 0) {
      const findreservation = findroom("roomNumber", reservation.roomNumber, totalrooms);
      console.log("馃殌 ~ file: hotel.js:52 ~ addReservation ~ findreservation:", findreservation)

      if (findreservation) {
        if (modDate(findreservation.checkIn) > modDate(reservation.checkOut) &&
          modDate(findreservation.checkOut) < modDate(reservation.checkIn)) {
          totalrooms.push(reservation);
          return "La habitaci贸n a sido reservada";

        } else {
          throw new Error("La habitaci贸n no est谩 disponible");
        }

      } else {
        totalrooms.push(reservation);
        return "La habitaci贸n a sido reservada";
      }   // 
    } else {

      totalrooms.push(reservation);

      return "La habitaci贸n a sido reservada";
    }



  }

  function removeReservation(id) {
    let remove = findroom("id", id, totalrooms);
    let index = totalrooms.indexOf(remove);
    if (index >= 0) {
      totalrooms.splice(index, 1);    
      return remove;
    }
    throw new Error("La reservaci贸n que se busca remover no existe");
  }

  function getReservations() {
   // if (totalrooms.length === 0) {
   //   for (let i = 0; i < length; i++) {
   //     totalrooms.push(i + 1);
   //   }
  //    return totalrooms;
  //  }

    return totalrooms
  }

  function getAvailableRooms(checkIn, checkOut) {
    const rooms = [];
    const filteroom = totalrooms.filter(room =>
     !(modDate(room.checkIn) > modDate(checkOut) || modDate(room.checkOut) < modDate(checkIn))
    );
    if (filteroom.length === 0) {
      for (let i = 0; i < length; i++) {
                   
        rooms.push(i + 1);
       
      }

    } else {
      for (let i = 0; i < length; i++) {
        if (!findroom("roomNumber", i + 1, filteroom)) {
          rooms.push(i + 1);
        }
      }
    }  
    return rooms.sort((a, b) => a - b);
  }


  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  }
}

MI SOLUCION:

.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.

este ejercicio fue medio complicado, por las fechas, creo que puede mejorar si uso mas los Date(), pero bueno.

function hotelSystem(rooms) {
  const reserv = [];
  return {
    searchReservation: (id) => {
      const res = reserv.find(reserve => reserve.id === id);
      if (res) return res;
      else throw new Error("La reservaci贸n no fue encontrada");
    },
    getSortReservations: () => {
      return [...reserv].sort((reserve1, reserve2) => {
        if (reserve1.checkIn > reserve2.checkIn) return 1;
        if (reserve1.checkIn < reserve2.checkIn) return -1;
        if (reserve1.checkIn === reserve2.checkIn) return 0;
      });
    },
    
    addReservation: (reservation) => {
      if (reservation.checkIn > reservation.checkOut) {
        throw new Error("La fecha de llegada no puede ser despu茅s de la salida");
      }
      const isReserved = reserv.filter(({checkIn, checkOut}) =>
            checkIn <= reservation.checkOut && checkOut >= reservation.checkIn
          ).some(({roomNumber}) => roomNumber === reservation.roomNumber);
      if (isReserved) throw new Error("La habitaci贸n no est谩 disponible");
      reserv.push(reservation);
      return "Reservaci贸n registrada exitosamente";
    },
    
    removeReservation: (id) => {
      const index = reserv.findIndex(reserve => reserve.id === id);
      if (index === -1) throw new Error("La reservaci贸n que se busca remover no existe");
      return reserv.splice(index,1)[0];
    },
    
    
    // obtener reservations
    getReservations: () => reserv,
  
    getAvailableRooms: (checkIn, checkOut) => {
      const availableRooms = Array.from({length: 10}, (_, i) => i + 1)
      
      const reserved =  reserv.filter(reservation => reservation.checkIn <= checkOut && reservation.checkOut >= checkIn)
      reserved.forEach(({roomNumber}) => {
        if (availableRooms.includes(roomNumber)) {
          availableRooms.splice(availableRooms.indexOf(roomNumber), 1);
        }
      })
      return availableRooms;
    }
  }
}

Aqu铆 mi soluci贸n, me tomo 2 d铆as, cabe recalcar que vengo de 0 en JS y con las fechas hice lo que mi l贸gica me indico hacer jaja

export function hotelSystem(rooms) {
  let reservations = [];

  function reformatDateMMDD(value) { //CONVERTIRMOS A FORMATO DE FECHA QUE JAVASCRIPT PUEDA LEER (MM/DD/YYYY) ********
    value.split("");
    let dd = value[0] + value[1];
    let mm = value[3] + value[4];
    value = mm + "/" + dd + "/2023";
    return value;
  }
  function reformatDateDDMM(value) { //CONVERTIRMOS A FORMATO DE FECHA (DD/MM) ***************************************
    value.split("");
    let mm = value[0] + value[1];
    let dd = value[3] + value[4];
    value = dd + "/" + mm;
    return value;
  }

  function addReservation(reservation) { // FUNCI脫N PARA AGREGAR RESERVACI脫N *****************************************
    if (reservation.roomNumber > rooms || reservation.roomNumber <= 0) { //VERIFICAMOS QUE EL ROOM SOLICITADO EXISTA
      throw Error("El numero de cuarto no existe");
    }
    if (reservations.some(element => { return element.id === reservation.id })) { //VERIFICAR EL ID
      throw Error("El id esta repetido");
    }

    if (reservations.length === 0) { //SI EL ARRAY DE RESERVACIONES ESTA VACIO SE REGISTRA SIN CONSULTAS
      reservations.push(reservation);
    } else { //SI EL ARRAY TIENE RESERVACIONES VERIFICAMOS QUE LA FECHA NO CHOQUE
      let checkIn = reservation.checkIn;
      let checkOut = reservation.checkOut;
      let roomAvailable = reservations.some(element => {
        return element.roomNumber === reservation.roomNumber //VERIFICAMOS SI EL CUARTO SOLICITADO ESTA RESERVADO (EN OTRA FECHA)
      });
      if (roomAvailable) { //SI EL CUARTO ESTA RESERVADO VERIFICAMOS QUE LA FECHA NO CHOQUE CON LA NUEVA RESERVACION 
        if (available = reservations.some(element => {
          let checkInReservated = element.checkIn;
          let checkOutReservated = element.checkOut;
          return (checkOutReservated < checkIn || checkInReservated > checkOut);  //VERIFICAMOS SI CHOCA LA FECHA SOLICITADA CON OTRA
        })) {
          reservations.push(reservation); //SI LA FECHA SOLICITADA NO CHOCA SE REGISTRA LA RESERVACION
        } else {
          throw new Error("La habitaci贸n no est谩 disponible"); //SI LA HABITACION CHOCA CON OTRA RESERVACION SE LANZA UN ERROR
        }
      } else {
        reservations.push(reservation) //SI EL CUARTO AUN NO HA SIDO RESERVADO LO REGISTRA 
      }
    }
    return "Registrado";
  }

  function searchReservation(id) { // FUNCI脫N PARA BUSCAR RESERVACI脫N ***************************************************
    let status = reservations.findIndex(element => {
      return element.id === id;
    });
    if (status >= 0) { return reservations[status] } else { throw Error("La reservaci贸n no fue encontrada") }
  }

  function getSortReservations() { // FUNCI脫N PARA ORDERNAR RESERVACIONES DE MANERA ASC *********************************
    let orderReservations = reservations.map(element => element);
    orderReservations.forEach(element => element.checkIn = reformatDateMMDD(element.checkIn));
    orderReservations.sort((a, b) => new Date(a.checkIn) - new Date(b.checkIn));
    orderReservations.forEach(element => element.checkIn = reformatDateDDMM(element.checkIn));
    return orderReservations;
  }

  function removeReservation(id) { // FUNCI脫N PARA ELIMINAR UNA RESERVACION *********************************************
    let status = reservations.findIndex(element => {
      return element.id === id;
    });
    let deleted = reservations[status];
    if (status >= 0) { reservations.splice(status) } else { throw Error("La reservaci贸n que se busca remover no existe") }
    return deleted;
  }

  function getReservations() { // FUNCI脫N PARA VER LAS RESERVACIONES ****************************************************
    return reservations;
  }

  function getAvailableRooms(checkIn, checkOut) { // FUNCI脫N PARA VER LAS HABITACIONES DISPONIBLES EN UN RANGO DE FECHAS *
    checkIn = checkIn;
    checkOut = checkOut;
    let availablesRooms = [];
    for (let i = 0; i < rooms; i++) {
      availablesRooms[i] = i + 1;
    }
    reservations.forEach(element => {
      let checkInReservated = element.checkIn;
      let checkOutReservated = element.checkOut;
      if (!(checkOutReservated < checkIn || checkInReservated > checkOut)) {
        let status = availablesRooms.findIndex(room => {
          return room === element.roomNumber;
        });
        if (status >= 0) {
          availablesRooms.splice(status, 1);
        }
      }
    });
    return availablesRooms;
  }

  return { addReservation, searchReservation, getSortReservations, removeReservation, getReservations, getAvailableRooms };
}

Mi soluci贸n:

export function hotelSystem(rooms) {
  let roomList = []
  for (let i = 1; i <= rooms; i++) {
    roomList.push(i);
  }
  let reservations = []
  return {
    searchReservation(id) {
      const reservation = reservations.find((reservation) => reservation.id === id)
      if (!reservation) { throw new Error("La reservaci贸n no fue encontrada")}
      return reservation
    },
    getSortReservations() {
      const sortedReservations = [...reservations]
      sortedReservations.sort((reservationA, reservationB) => {
        const fechaA = new Date(`2023-${reservationA.checkIn}`).getTime()
        const fechaB = new Date(`2023-${reservationB.checkIn}`).getTime()
        return fechaA - fechaB
      })
      return sortedReservations
    },
    addReservation(reservation) {
      const reservedRoom = reservations.find((reserved) => reserved.roomNumber === reservation.roomNumber)
      console.log(reservedRoom)
      const reservedCheckIn = reservedRoom ? new Date(`2023-${reservedRoom.checkIn}`).getTime() : 0
      const reservedCheckOut = reservedRoom ? new Date(`2023-${reservedRoom.checkOut}`).getTime() : 0
      const reservationCheckIn = new Date(`2023-${reservation.checkIn}`).getTime()
      const reservationCheckOut = new Date(`2023-${reservation.checkOut}`).getTime()
      if ((reservationCheckIn >= reservedCheckIn && reservationCheckIn <= reservedCheckOut) || (reservationCheckOut >= reservedCheckIn && reservationCheckOut <= reservedCheckOut) || (reservationCheckIn <= reservedCheckIn && reservationCheckOut >= reservedCheckOut)) {
        throw new Error("La habitaci贸n no est谩 disponible")
      }
      reservations.push(reservation)
      return "Reservaci贸n realizada"
    },
    removeReservation(id) {
      const index = reservations.findIndex((reservation) => reservation.id === id)
      const reservation = reservations[index]
      if (index === -1) { throw new Error("La reservaci贸n que se busco remover no existe") }
      reservations.splice(index, 1)
      return reservation
    },
    getReservations() { return reservations },
    getAvailableRooms(checkIn, checkOut) {
      let availableRooms = [...roomList]
      const reservationCheckIn = new Date(`2023-${checkIn}`).getTime()
      const reservationCheckOut = new Date(`2023-${checkOut}`).getTime()

      for (let reservation of reservations) {
        const reservedCheckIn = new Date(`2023-${reservation.checkIn}`).getTime()
        const reservedCheckOut = new Date(`2023-${reservation.checkOut}`).getTime()
        if ((reservationCheckIn >= reservedCheckIn && reservationCheckIn <= reservedCheckOut) || (reservationCheckOut >= reservedCheckIn && reservationCheckOut <= reservedCheckOut) || (reservationCheckIn <= reservedCheckIn && reservationCheckOut >= reservedCheckOut)) {
          const index = availableRooms.indexOf(reservation.roomNumber)
          if (index !== -1) { availableRooms.splice(index, 1) }
        }
      }
      return availableRooms
    }
  }
}

Dejo mi soluci贸n:
.
.
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  // Tu c贸digo aqu铆
  const reservations = [];

  const getIndexOrError = (id, message) => {
    const index = reservations.findIndex(reservation => reservation.id === id)
    if (index == -1) throw new Error(message);
    return index;
  }

  const getOverlapedReservations = (checkIn, checkOut) => {
    return reservations
      .filter(rsv => rsv.checkIn <= checkOut && rsv.checkOut >= checkIn);
  }

  return {
    searchReservation: id => {
      const index = getIndexOrError(id, "La reservaci贸n no fue encontrada");
      return reservations[index];
    },

    getSortReservations: () => {
      return [...reservations]
        .sort((rsv1, rsv2) => {
          if (rsv1.checkIn > rsv2.checkIn) return 1;
          if (rsv1.checkIn < rsv2.checkIn) return -1;
          if (rsv1.checkIn == rsv2.checkIn) return 0;
        });
    },

    addReservation: reservation => {
      if (reservation.checkIn > reservation.checkOut) {
        throw new Error("La fecha de llegada no puede ser despu茅s de la salida");
      }

      const isRoomReserved = getOverlapedReservations(reservation.checkIn, reservation.checkOut)
        .some(rsv => rsv.roomNumber === reservation.roomNumber);

      if (isRoomReserved) throw new Error("La habitaci贸n no est谩 disponible");

      reservations.push(reservation);
      return "Reservaci贸n registrada exitosamente";
    },

    removeReservation: id => {
      const index = getIndexOrError(id, "La reservaci贸n que busca remover no existe");
      return reservations.splice(index, 1)[0];
    },

    getReservations: () => reservations,

    getAvailableRooms: (checkIn, checkOut) => {
      const availableRooms = [];

      for (let i = 0; i < rooms; i++) availableRooms[i] = i + 1;

      for (const rsv of getOverlapedReservations(checkIn, checkOut)) {
        if (availableRooms.includes(rsv.roomNumber)) {
          availableRooms.splice(availableRooms.indexOf(rsv.roomNumber), 1);
        }
      }
      return availableRooms;
    }
  }
}

Holy moly

export function hotelSystem(rooms) {
  let totalrooms = rooms;
  let reservations = [];

  function getSortReservations() {
    const reservationscopy = [...reservations];
    reservationscopy.sort((a, b) => {
      const keyA = new Date(`${a.checkIn}/2023`);
      const keyB = new Date(`${a.checkIn}/2023`);
      if (keyA < keyB) return -1;
      if (keyA > keyB) return 1;
      return 0;
    })
    return reservationscopy;
  }

  function searchReservation(id) {
    const reservation = reservations.find(item => item.id === id);
    return reservation ? reservation : new Error("La reservaci贸n no fue encontrada");
  }

  function addReservation(reservation) {
    const reserexist = reservations.find(item => item.id == reservation.id);
    if (reserexist && new Date(reserexist.checkIn) <= new Date(reservation.checkIn) && new Date(reserexist.checkOut) >= new Date(reservation.checkOut)) {
      return new Error("La habitaci贸n no est谩 disponible");
    } else {
      reservations.push(reservation);
    }
    return reservations;
  }

  function removeReservation(id) {
    const index = reservations.findIndex(item => item.id == id);
    if (index > -1) {
      array.splice(index, 1);
    } else {
      return new Error("La reservaci贸n que se busca remover no existe");
    }
    return reservations;
  }

  function getReservations() {
    return reservations;
  }

  function getAvailableRooms(checkIn, checkOut) {
    let availablesrooms = [];
    let unavailablesrooms = [];
    for (let i = 0; i <= reservations.length; i++) {
      if (new Date(reservations[i]?.checkIn) >= new Date(checkIn) && new Date(reservations[i]?.checkOut) <= new Date(checkOut)) {
        unavailablesrooms.push(reservations[i].roomNumber);
      }
    }
    for (let i = 1; i <= totalrooms; i++) {
      if (!unavailablesrooms.includes(i)) {
        availablesrooms.push(i);
      }
    }
    return availablesrooms;
  }

  return {
    getSortReservations,
    searchReservation,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  }
}

Mi soluci贸n, despu茅s de pelearme tanto m谩s que con la l贸gica, con el formato de salida de cada funci贸n que a prop贸sito no se especific贸 para algunas funciones, ejemplo: funci贸n addReservation, la cual esperaba un string como out de 茅xito y yo retornando las reservations, ufffff, pero bueno.

export function hotelSystem(rooms) {
  const reservations = new Array(rooms);
  for (let i = 0; i < rooms; i++) {
    reservations[i] = new Array();
  }

  return {
    searchReservation: function (id) {
      const rta = [...reservations].flat().filter(item => item.id == id);
      if (rta.length>0)
        return rta[0];
      else
        throw new Error("La reservaci贸n no fue encontrada");
    },
    getSortReservations: function () {
      return [...reservations].flat().sort((a, b) => new Date(a.checkIn) - new Date(b.checkIn));
    },
    getAvailableRooms: function (checkIn, checkOut) {
      const habDisponibles = [];
      for (let i = 0; i < reservations.length; i++) {
        if (reservations[i].length > 0) {
          let rta = reservations[i].filter(item => new Date(item.checkout) < new Date(checkIn) || new Date(item.checkIn) > new Date(checkOut));
          if (rta.length > 0)
            habDisponibles.push(i + 1);
        } else {
          habDisponibles.push(i + 1);
        }
      }
      return habDisponibles;
    },
    addReservation: function (reservation) {
      if (reservation.roomNumber-1>reservations.length){ 
          throw new Error("El n煤mero de habitaci贸n no existe");
      }
      try {
          if(this.searchReservation(reservation.id)){  //verifica si id ya existe
              throw new Error(`El id: ${reservation.id} ya existe, debe insertar un id diferente`);
          }
      } catch (error) {  // se catcha el error generado por search e insertamos el nuevo elemento       
      const rta = this.getAvailableRooms(reservation.checkIn, reservation.checkOut);
      if (rta.includes(reservation.roomNumber)) {
        reservations[reservation.roomNumber - 1].push(reservation);
        return "Inserci贸n exitosa";//[...reservations].flat();
      } else {
        throw new Error("La habitaci贸n no est谩 disponible");
      }
    }
    },
    removeReservation: function (id) {
      for (let i = 0; i < reservations.length; i++) {
        if (reservations[i].length > 0) {
          for (let j = 0; j < reservations[i].length; j++) {
            if (reservations[i][j].id == id) {
              const itemRemoved = reservations[i][j];
              reservations[i].splice(j, 1);
              return itemRemoved;
            }
          }
        }
      }
      throw new Error("La reservaci贸n que se busca remover no existe");
    },
    getReservations: function () {
      return [...reservations].flat();
    },
  }
}

馃槹馃槄 Despu茅s de un buen rato de c贸digo, aqu铆 est谩 mi soluci贸n:
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  let reservations = [];
  const roomArray = [];
  for (let i = 0; i < rooms; i++) {
    roomArray.push({
      roomNumber: i + 1,
      available: true,
      checkIn: null,
      checkOut: null
    });
  }

  const searchReservation = (id) => {
    const reservation = reservations.find(reserv => reserv.id === id);
    if (reservation) {
      return reservation;
    } else {
      throw new Error("La reservaci贸n no fue encontrada");
    }
  }

  const getSortReservations = () => {
    if (reservations.length > 0) {
      const sortedReservations = [...reservations]
      sortedReservations.sort((a, b) => new Date(a.checkIn) - new Date(b.checkIn));
      return sortedReservations;
    }
  }

  const addReservation = (reservation) => {
    const isRoomReserved = reservations.some((reserv) => reserv.roomNumber === reservation.roomNumber);

    if (isRoomReserved) {
      const previousReservation = reservations.find((reserv) => reserv.roomNumber === reservation.roomNumber);
      const isDateAvailable = (
        new Date(reservation.checkOut) <= new Date(previousReservation.checkIn) ||
        new Date(reservation.checkIn) >= new Date(previousReservation.checkOut));

      if (isDateAvailable) {
        reservations.push(reservation);
        const roomIndex = roomArray.findIndex((room) => room.roomNumber === reservation.roomNumber);
        roomArray[roomIndex] = {
          ...roomArray[roomIndex],
          available: false,
          checkIn: reservation.checkIn,
          checkOut: reservation.checkOut,
        }
        return "Reservaci贸n exitosa";
      } else {
        throw new Error("La habitaci贸n no est谩 disponible");
      }
    } else {
      reservations.push(reservation);
      const roomIndex = roomArray.findIndex((room) => room.roomNumber === reservation.roomNumber)
      roomArray[roomIndex] = {
        ...roomArray[roomIndex],
        available: false,
        checkIn: reservation.checkIn,
        checkOut: reservation.checkOut,
      };
        return "Reservaci贸n exitosa";
    }
  };

  const removeReservation = (id) => {
    const reserveExists = reservations.some((reserv) => reserv.id === id);

    if (reserveExists) {
      const deletedReservation = reservations
        .find((reserv) => reserv.id === id);

      const roomIndex = roomArray.findIndex((room) => room.roomNumber === deletedReservation.roomNumber);
      roomArray[roomIndex] = {
        ...roomArray[roomIndex],
        available: true,
        checkIn: null,
        checkOut: null,
      };
      
      const newReservationsArray = reservations
        .filter((reserv) => reserv.id !== id);

      reservations = [...newReservationsArray];

      return deletedReservation;
    } else {
      throw new Error("La reservaci贸n que se busca remover no existe");
    }
  };

  const getReservations = () => {
    console.log(reservations);
    console.log('rooms:', roomArray);
    return reservations;
  };

  const getAvailableRooms = (checkIn, checkOut) => {
    const availableRooms = roomArray.filter(room => {
      return (
        !!room.available ||
        new Date(checkOut) < new Date(room.checkIn) ||
        new Date(checkIn) > new Date(room.checkOut)
      )
    });

    return availableRooms.map(room => room.roomNumber);
  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  };
}

My solution

export function hotelSystem(rooms) {
  let listReservation = [];

  return {
    searchReservation: (id) => {
      const index = getIndex(listReservation, id);

      return index > -1
        ? listReservation[index]
        : (function () {
            throw new Error("La reservaci贸n que se busca remover no existe");
          })();
    },
    getSortReservations: () =>
      [...listReservation].sort(
        (a, b) => getDate(a.checkIn) - getDate(b.checkIn)
      ),
    addReservation: (reservation) => {
      if (
        listReservation.findIndex(
          ({ roomNumber, checkIn, checkOut }) =>
            roomNumber == reservation.roomNumber &&
            isAvailable({ checkIn, checkOut }, reservation)
        ) == -1
      ) {
        return listReservation.push(reservation) && "Reserva exitosa";
      }
      throw new Error("La habitaci贸n no est谩 disponible");
    },
    removeReservation: (id) => {
      const reservationExist = getIndex(listReservation, id);
      if (reservationExist > -1) {
        const removeReservation = listReservation[reservationExist];
        listReservation.splice(reservationExist, 1);
        return removeReservation;
      }
      throw new Error("La reservaci贸n que se busca remover no existe");
    },
    getReservations: () => listReservation,
    getAvailableRooms: (checkIn, checkOut) => {
      const bussyRooms = listReservation
        .map((room) =>
          isAvailable(room, { checkIn, checkOut }) ? room.roomNumber : null
        )
        .filter(Boolean);
      return new Array(rooms + 1)
        .fill()
        .map((x, idx) => (!bussyRooms.includes(idx) ? idx : null))
        .filter(Boolean);
    },
  };
}

const getDate = (date) => new Date(date.split("/").reverse().join("/"));
const getIndex = (array, id) => array.findIndex((item) => item.id === id);

function isAvailable(room, reservation) {
  if (room.checkIn) {
    const statusCheckIn =
      getDate(room.checkIn) >= getDate(reservation.checkIn) &&
      getDate(reservation.checkIn) <= getDate(room.checkOut);
    const statusCheckOut =
      getDate(reservation.checkOut) >= getDate(room.checkIn) &&
      getDate(reservation.checkOut) <= getDate(room.checkOut);
    return statusCheckIn || statusCheckOut;
  }
  return true;
}

-------------------------- SPOILER ALERT--------------------------
*
*
*
*
*
*
*
*
*
*
*
Por aca les comparto mi soluci贸n, espero les guste y encuentren una manera diferente de resolver el reto.

export function hotelSystem(rooms) {
  let reservations = []

  const checkAvailability = ({ checkIn, checkOut, roomNumber }) => {
    const isRoomReserved = reservations.filter(item => item.roomNumber == roomNumber)

    if (isRoomReserved.length) {

      const validateCheckIn = isRoomReserved.some(item => checkIn >= item.checkIn && checkIn <= item.checkOut)

      const validateCheckOut = isRoomReserved.some(item => checkOut >= item.checkIn && checkOut <= item.checkOut)

      if (validateCheckIn || validateCheckOut) {
        return false
      }

    }

    return true
  }

  const searchReservation = id => {
    const reservation = reservations.find(item => item.id == id)

    if (!reservation) {
      throw new Error("La reservaci贸n no fue encontrada")
    }

    return reservation
  }

  const getSortReservations = () => {
    return [...reservations].sort((a, b) => {
      return new Date(a.checkIn) - new Date(b.checkIn)
    })
  }

  const addReservation = reservation => {
    const isAvailable = checkAvailability(reservation)

    if (!isAvailable) throw new Error("La habitaci贸n no est谩 disponible")
    reservations.push(reservation)

    return 'Reserva exitosa'
  }

  const removeReservation = id => {
    const reservation = reservations.find(item => item.id == id)
    if (!reservation) {
      throw new Error("La reservaci贸n que se busca remover no existe")
    }

    reservations = reservations.filter(item => item.id !== id)

    return reservation
  }

  const getReservations = () => {
    return reservations
  }

  const getAvailableRooms = (checkIn, checkOut) => {
    let availableRooms = []

    for (let i = 1; i <= rooms; i++) {
      if (checkAvailability({ checkIn, checkOut, roomNumber: i })) {
        availableRooms.push(i)
      }
    }

    return availableRooms
  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  }
}

Les dejo otra posible solucion, ya que estuve jugando un poco con el codigo en especial para el getAvaiableRooms
.
.
.
.
.
.
.

const capacity = rooms;
  const reservations = [];

  const reservationOverlaps = (reservation, newReservation) => {
    const { checkIn, checkOut, roomNumber } = newReservation;
    if (
      (reservation.checkIn <= checkIn && checkIn <= reservation.checkOut) ||
      (reservation.checkIn <= checkOut && checkOut <= reservation.checkOut) ||
      (checkIn < reservation.checkIn && reservation.checkOut < checkOut)
    ) {
      if (reservation.roomNumber === roomNumber) {
        return true;
      }
    }

    return false;
  };

  const searchReservation = (id) => {
    const reservation = reservations.find((res) => res.id === id);
    if (reservation) {
      return reservation;
    }
    throw new Error('La reservaci贸n no fue encontrada');
  };

  const getSortReservations = () => {
    const copyReservations = [...reservations];
    return copyReservations.sort(
      (a, b) => new Date(a.checkIn) - new Date(b.checkIn)
    );
  };

  const addReservation = (reservation) => {
    const reservationsThatOverlaps = reservations.filter((res) =>
      reservationOverlaps(res, reservation)
    );
    if (reservationsThatOverlaps.length > 0) {
      throw new Error('La habitaci贸n no est谩 disponible');
    } else {
      reservations.push(reservation);
    }
    return 'Reserva exitosa';
  };

  const removeReservation = (id) => {
    const reservationIndex = reservations.findIndex((res) => res.id === id);
    if (reservationIndex !== -1) {
      return reservations.splice(reservationIndex, 1)[0];
    } else {
      throw new Error('La reservaci贸n que se busca remover no existe');
    }
  };

  const getReservations = () => {
    return reservations;
  };

  const getAvailableRooms = (checkIn, checkOut) => {
    const initialReservations = Array.from(
      { length: capacity },
      (_, i) => i + 1
    ).reduce((acc, curr) => ((acc[curr] = []), acc), {});

    console.log('initialReservations', initialReservations);

    const reservationsByRoomNumber = reservations.reduce((obj, res) => {
      obj[res.roomNumber] = obj[res.roomNumber].concat(res);
      return obj;
    }, initialReservations);

    console.log('reservationsByRoomNumber', reservationsByRoomNumber);
    return Object.entries(reservationsByRoomNumber)
      .filter(([roomNumber, reservations]) => {
        if (reservations.length === 0) return true;
        return !reservations.some((res) => {
          const newReservation = {
            checkIn,
            checkOut,
            roomNumber: Number(roomNumber),
          };
          return reservationOverlaps(res, newReservation);
        });
      })
      .map(([roomNumber, reservations]) => Number(roomNumber));
  };

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms,
  };

Dejo mi solucion
.
.
.
.
.
.
.

function hotelSystem(rooms) {
  const capacity = rooms;
  const reservations = [];

  const reservationOverlaps = (res, checkIn, checkOut, roomNumber) => {
    if (
      (res.checkIn <= checkIn && checkIn <= res.checkOut) ||
      (res.checkIn <= checkOut && checkOut <= res.checkOut) ||
      (checkIn < res.checkIn && res.checkOut < checkOut)
    ) {
      if (res.roomNumber === roomNumber) {
        return true;
      }
    }

    return false;
  };

  const searchReservation = (id) => {
    const reservation = reservations.find((res) => res.id === id);
    if (reservation) {
      return reservation;
    }
    throw new Error('La reservaci贸n no fue encontrada');
  };

  const getSortReservations = () => {
    const copyReservations = [...reservations];
    return copyReservations.sort(
      (a, b) => new Date(a.checkIn) - new Date(b.checkIn)
    );
  };

  const addReservation = (reservation) => {
    const reservationsThatOverlaps = reservations.filter((res) =>
      reservationOverlaps(
        res,
        reservation.checkIn,
        reservation.checkOut,
        reservation.roomNumber
      )
    );
    if (reservationsThatOverlaps.length > 0) {
      throw new Error('La habitaci贸n no est谩 disponible');
    } else {
      reservations.push(reservation);
    }

    return 'Reserva exitosa';
  };

  const removeReservation = (id) => {
    const reservationIndex = reservations.findIndex((res) => res.id === id);
    if (reservationIndex !== -1) {
      return reservations.splice(reservationIndex, 1)[0];
    } else {
      throw new Error('La reservaci贸n que se busca remover no existe');
    }
  };

  const getReservations = () => {
    return reservations;
  };

  const getAvailableRooms = (checkIn, checkOut) => {
    let availableRooms = [];

    for (let i = 1; i <= capacity; i++) {
      if (
        reservations.every((res) => {
          return !reservationOverlaps(res, checkIn, checkOut, i);
        })
      ) {
        availableRooms.push(i);
      }
    }

    return availableRooms;
  };

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms,
  };
}

Comparto mi soluci贸n
Anti spoilers
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Esta soluci贸n la plantee con un arreglo de reservas bidimensional donde la primera dimensi贸n (fila) corresponde a las habitaciones y la segunda dimensi贸n (columna) corresponde a las reservas:

Aunque si corren las pruebas hay algunas que fallaron pero en entorno de VSC todo sali贸 bien seg煤n lo solicitado.

export function hotelSystem(rooms) {
  const roomReservations = [];
  let checkIn, checkOut, exists;
  for (let i = 0; i < rooms; i++) roomReservations.push([]);

  // principal functions

  const searchReservation = (id) => {
    validateReservations();
    return validateId(id, "La reservaci贸n no fue encontrada");
  }

  const getSortReservations = (room = 0) => {
    validateReservations(room);
    if (room == 0) {
      return [...roomReservations].flat().sort((a, b) => getDateMs(a.checkIn) - getDateMs(b.checkIn));
    }
    if (room > roomReservations.length) {
      throw new Error("La habitaci贸n no existe");
    }
    return [...roomReservations[room - 1]].flat().sort((a, b) => getDateMs(a.checkIn) - getDateMs(b.checkIn));
  }

  const addReservation = (reservation) => {
    if (reservation.roomNumber > roomReservations.length) {
      throw new Error("La habitaci贸n no existe");
    }

    if (roomReservations.flat().find(elem => elem.id === reservation.id)) {
      throw new Error("El ID ya existe");
    }

    const idx = reservation.roomNumber - 1;
    const room = roomReservations[idx];

    if (room.length > 0) {
      checkIn = getDateMs(reservation.checkIn);
      checkOut = getDateMs(reservation.checkOut);
      exists = room.find(existReservation => {
        return validateDateReservation(checkIn, checkOut, existReservation);
      })
      if (exists) throw new Error("La habitaci贸n no est谩 disponible");
    }

    room.push(reservation);
    return "Reserva registrada exitosamente";
  }

  const removeReservation = (id) => {
    const result = validateId(id, "La reservaci贸n que se busca remover no existe");
    const room = roomReservations[result.roomNumber - 1];
    const idx = room.findIndex(x => x.id === id);
    return room.splice(idx, 1)[0];
  }

  const getReservations = (room = 0) => {
    validateReservations(room);
    if (room == 0) {
      return roomReservations.flat();
    }
    if (room > roomReservations.length) {
      throw new Error("La habitaci贸n no existe");
    }
    return roomReservations[room - 1];
  }

  const getAvailableRooms = (checkIn, checkOut) => {
    const available = [];
    checkIn = getDateMs(checkIn);
    checkOut = getDateMs(checkOut);
    for (let i = 0; i < roomReservations.length; i++) {
      exists = roomReservations[i].find(existReservation => {
        return validateDateReservation(checkIn, checkOut, existReservation);
      })
      if (!exists) available.push(i + 1);
    }
    return available;
  }

  // secondary functions

  const validateId = (id, msgError) => {
    const search = roomReservations.flat().find(reservation => reservation.id === id);
    if (!search) throw new Error(msgError);
    return search;
  }

  const validateReservations = (room = 0) => {
    if (room == 0 && roomReservations.flat().length === 0) throw new Error("No hay reservas listadas");
    if (room != 0 && roomReservations[room - 1].length === 0) throw new Error("No hay reservas listadas para la habitaci贸n");
  }

  const getDateMs = (string) => {
    const dateStr = string.concat("/").concat(new Date().getFullYear()).split("/").sort(() => -1).join("/");
    const dateDat = new Date(dateStr);
    return dateDat.getTime();
  }

  const validateDateReservation = (checkIn, checkOut, reservation) => {
    const ckInRs = getDateMs(reservation.checkIn);
    const ckOutRs = getDateMs(reservation.checkOut);
    return checkIn < ckInRs && checkOut > ckOutRs ||
      checkIn > ckInRs && checkOut < ckOutRs ||
      checkIn < ckInRs && checkOut > ckInRs ||
      checkIn < ckOutRs && checkOut > ckOutRs ||
      checkIn == ckInRs && checkOut < ckOutRs ||
      checkIn > ckInRs && checkOut == ckOutRs;
  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  }
}

*Segundo jefe de los 30 d铆as de JS

Usando la clase Date y el m茅todo getTime() pude hacer las comparaciones de las fechas que se necesitaban para registrar una nueva fecha, si no encontraba ninguna similitud con una fecha ya registrada, la a帽ado a la lista de reservaciones.
Para ordenar las reservaciones, igual usaba Data con el checkIn para hacer el ordenamiento en una copia sin alterar el original.
Finalmente para obtener los cuartos disponibles, recorr铆 los cuartos ya ocupados y obten铆a su n煤mero si coincid铆an con el rango de las fechas.

function hotelSystem(rooms) {
    let reservations = [];
    let quantity_rooms = rooms;
    return {
        addReservation: function (reservation) {
            const date_start = new Date(reservation.checkIn);
            const date_end = new Date(reservation.checkOut);
            let reservarion_find = reservations.find(reservation_list => {
                const re_start = new Date(reservation_list.checkIn);
                const re_end = new Date(reservation_list.checkOut);
                return date_start.getTime() >= re_start.getTime() && date_end.getTime() <= re_end.getTime() && reservation.roomNumber == reservation_list.roomNumber;
            });

            if (reservarion_find == undefined) {
                reservations.push(reservation);
                return "se ha registrado correctamente";
            }
            throw new Error("La habitaci贸n no est谩 disponible");
        },
        searchReservation: function (id) {
            const index_reservation = reservations.findIndex(
                reservation => reservation.id == id
            );
            if (reservations > 0) {
                return reservations[index_reservation];
            }
            throw new Error("La reservaci贸n no fue encontrada");
        },
        getReservations: function () {
            return reservations;
        },
        getSortReservations: function () {
            return [...reservations].sort((reservation1, reservation2) => {
                const check1 = new Date(reservation1.checkIn);
                const check2 = new Date(reservation2.checkIn);
                return check1.getTime() - check2.getTime();
            });
        },
        searchReservation: function (id) {
            let reservation_searched = reservations.find(
                reservation => reservation.id == id
            );
            if (reservation_searched == undefined) 
                throw new Error("La reservaci贸n no fue encontrada");
            return reservation_searched;
        },
        removeReservation: function (id) {
            let reservation_index = reservations.findIndex(reservation => reservation.id===id);
            if (reservation_index == -1) throw new Error("La reservaci贸n que se busca remover no existe");
            let remove_reservation = reservations[reservation_index];
            reservations.splice(reservation_index,1);
            return remove_reservation;
        },
        getAvailableRooms: function (checkIn, checkOut) {
            let rooms_available = [];
            let rooms_fill = [];
            let date_start = new Date(checkIn);
            let date_end = new Date(checkOut);
            reservations.forEach(reservation_list => {
                let reservation_start = new Date(reservation_list.checkIn);
                let reservation_end = new Date(reservation_list.checkOut);
                if (reservation_start.getTime() >= date_start.getTime() || reservation_end.getTime() <= date_end.getTime()) {
                    rooms_fill.push(reservation_list.roomNumber);
                }
            });
            for (let i = 1; i <= quantity_rooms; i++) {
                if (!rooms_fill.includes(i)) {
                    rooms_available.push(i);
                }
            }
            return rooms_available;
        }
    }
}

Hola, dejo mi solucion
Caminito anti spoilers
馃殫
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Llegamos 馃搷

Siento que esto aun puede mejorar, en estos d铆as le realizare algun refactor 馃尭馃じ鈥嶁檧锔

export function hotelSystem(rooms) {
  // Tu c贸digo aqu铆
  let listRooms = [];
  const searchReservation = (id) => {
    let result = listRooms.find((room) => room.id === id);
    if (result) {
      return result
    } else {
      throw new Error("La reservaci贸n no fue encontrada");
    }
  };
  const getSortReservations = () => {
    let ordenado = [...listRooms];
    return ordenado.sort((a, b) => Date.parse(formatDate(a.checkIn)) - Date.parse(formatDate(b.checkIn)));
  };
  const addReservation = (reservation) => {
    if (listRooms.length === 0) {
      listRooms.push(reservation);
      return 'Recervaci贸n agregada exitosamente'
    }
    let habitacionRegistrada = false;
    const fechasNoDisponibles = listRooms.find((room) => room.roomNumber === reservation.roomNumber && validateDates(room.checkIn, room.checkOut, reservation.checkIn, reservation.checkOut))
    if (fechasNoDisponibles) {
      throw new Error("La habitaci贸n no est谩 disponible");
    } else if (listRooms.length < rooms) {
      listRooms.push(reservation);
      habitacionRegistrada = true;
    }
  }
  const removeReservation = (id) => {
    const index = listRooms.findIndex((room) => room.id === id);
    if (index < 0) {
      throw new Error("La reservaci贸n que se busca remover no existe");
    } else {
      const habitacionRemovida = listRooms.splice(index, 1)
      return habitacionRemovida[0];
    }
  };

  const getReservations = () => listRooms;

  const getAvailableRooms = (checkIn, checkOut) => {
    let availableRooms = [...Array(rooms).keys()].map(i => i + 1)
    const habitacionesOcupadas = [];
    listRooms.forEach((room) => {
      if (validateDates(room.checkIn, room.checkOut, checkIn, checkOut)) {
        habitacionesOcupadas.push(room.roomNumber);
      }
    });
    habitacionesOcupadas.forEach(room => {
      const index = availableRooms.findIndex((item) => item === room)
      availableRooms.splice(index, 1)
    });

    return availableRooms;
  };

  function validateDates(checkIntRegister, checkOutRegister, checkIntDate, checkOutDate) {
    const checkIntRegisterParse = Date.parse(formatDate(checkIntRegister));
    const checkOutRegisterParse = Date.parse(formatDate(checkOutRegister));
    const checkIntDateParse = Date.parse(formatDate(checkIntDate));
    const checkOutDateParse = Date.parse(formatDate(checkOutDate));

    const laFechaDeInicioEstaenmedio = checkIntDateParse >= checkIntRegisterParse && checkIntDateParse < checkOutRegisterParse;
    const laFechaDefINEstaenmedio = checkOutDateParse > checkIntRegisterParse && checkOutDateParse <= checkOutRegisterParse;
    const lasFechasEstanEntreMedio = checkIntDateParse <= checkIntRegisterParse && checkOutDateParse >= checkOutRegisterParse;

    return lasFechasEstanEntreMedio || laFechaDeInicioEstaenmedio || laFechaDefINEstaenmedio;
  }
  function formatDate(date) {
    const response = date.split('/')
    const month = response[1];
    const day = response[0];
    return `${month}/${day}`

  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  }
}

Mi soluci贸n. Lo complejo de este fue el operar sobre fechas. Yo lo que hice fue convertir las fechas en milisegundos utilizando un m茅todo de Date conocido como getTime() y as铆 poder hacer comparaciones con las fechas
.
.
.
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  const totalRooms = []
  for (let i = 1; i <= rooms; i++) 
    totalRooms.push(i)
    
  const reservations = []

// con esta funci贸n convierto las fechas en milisegundos usando getTime()
  function getTimeInMs(dateFormat) {
// como las fechas se reciben en formato "dd/mm", primero convierto el formato a n煤meros
    const dateArr = dateFormat.split('/').map(num => Number(num))
// luego le resto 1 al mes porque en programaci贸n los meses van de 0 a 11, no de 1 a 12
    dateArr[0] -= 1
// luego invierto los valores para tenerlos en forma "mm/dd"
    dateArr.reverse()
// creo una instancia de Date donde obtengo la fecha exacta, suponiendo que el a帽o siempre ser谩 2023
    const correctDate = new Date(2023, ...dateArr)
// devuelvo la fecha en milisegundos
    return correctDate.getTime()
  }

  return {
    getReservations() {
      return reservations
    },

    addReservation(reservation) {
      reservations.forEach(room => {
        if (room.roomNumber === reservation.roomNumber) {
// En estas 4 variables guardo el tiempo en milisegundos del checkIn y checkOut de las reservaciones que tengo en el array de reservations y de la reservaci贸n que quiero agregar en caso de que exista una reservaci贸n con el mismo n煤mero de habitaci贸n de reservation
          const reservationCheckIn = getTimeInMs(reservation.checkIn)
          const reservationCheckOut = getTimeInMs(reservation.checkOut)
          const roomCheckIn = getTimeInMs(room.checkIn)
          const roomCheckOut = getTimeInMs(room.checkOut)

/* En este if verifico que las fechas no se solapen haciendo las siguientes comparaciones: 
	1a. que el checkIn de la reserva sea mayor o igual que el checkIn de la habitaci贸n ya reservada
	1b. que el checkIn de la reserva sea menor o igual que el checkOut de la habitaci贸n ya reservada
		con 1a y 1b verifico si el checkIn de la nueva reserva se solapa con las fechas de la reserva ya existente
	2a. que el checkOut de la reserva sea mayor o igual que el checkIn de la habitaci贸n ya reservada
	2b. que el checkOut de la reserva sea menor o igual que el checkOut de la habitaci贸n ya reservada
		con 2a y 2b verifico si el checkOut de la nueva reserva se solapa con las fechas de la reserva ya existente
*/
          if (reservationCheckIn >= roomCheckIn && reservationCheckIn <= roomCheckOut || reservationCheckOut >= roomCheckIn && reservationCheckOut <= roomCheckOut) {
            throw new Error('La habitaci贸n no est谩 disponible')
          }
        }
      })
      reservations.push(reservation)
      return JSON.stringify(reservation)
    },

    getSortReservations() {
      const sortedReservations = [...reservations]
      return sortedReservations.sort((a, b) => getTimeInMs(a.checkIn) - getTimeInMs(b.checkIn))
    },

    removeReservation(id) {
      const reservationIndex = reservations.findIndex(reservation => reservation.id === id)
      if (reservationIndex < 0) {
        throw new Error('La reservaci贸n que se busca remover no existe')
      } else {
        const removedReservation = reservations.splice(reservationIndex, 1)
        return removedReservation[0]
      }
    },

    getAvailableRooms(checkIn, checkOut) {
      console.log(checkIn, checkOut)
      const availableRooms = [...totalRooms]
      reservations.forEach(reservation => {
// este proceso es exactamente igual al de addReservations
        const reservationCheckIn = getTimeInMs(reservation.checkIn)
        const reservationCheckOut = getTimeInMs(reservation.checkOut)
        const roomCheckIn = getTimeInMs(checkIn)
        const roomCheckOut = getTimeInMs(checkOut)

        if (reservationCheckIn >= roomCheckIn && reservationCheckIn <= roomCheckOut || reservationCheckOut >= roomCheckIn && reservationCheckOut <= roomCheckOut) {
          const noVacancyRoom = availableRooms.findIndex(room => room === reservation.roomNumber)
          availableRooms.splice(noVacancyRoom, 1)
        }
      })
      return availableRooms
    },

    searchReservation(id) {
      const reservation = reservations.find(reservation => reservation.id === id)
      if (!reservation)
        throw new Error('La reservaci贸n no fue encontrada')
      return reservation
    }
  }
}

Soluci贸n.

export function hotelSystem(rooms) {
  // Tu c贸digo aqu铆
  let totalRooms = rooms;
  let reservations = [];

  function convertDate(date) {
    let splitDate = date.split("/");
    return new Date(
      (new Date()).getFullYear(),
      splitDate[1] - 1,
      splitDate[0]
    ).getTime();
  }
  function isOcupped(reviewCheckIn, reviewCheckOut, checkIn, checkOut) {
    return (
      (reviewCheckIn >= checkIn && reviewCheckIn <= checkOut) ||
      (reviewCheckOut >= checkIn && reviewCheckOut <= checkOut)      
    );
  }
  function searchReservation(id) {
    let reservation = reservations.find(reservation => reservation.id === id);
    if (reservation) {
      return reservation;
    } else {
      throw new Error("La reservaci贸n no fue encontrada");
    }
  }
  function getSortReservations() {
    let list = [...reservations];
    list.sort((a, b) => convertDate(a.checkIn) - convertDate(b.checkIn));
    return list;
  }
  function addReservation(reservation) {
    if (reservation.roomNumber < 1 || reservation.roomNumber > totalRooms) {
      throw new Error("La habitaci贸n solicitada no existe");
    }
    if (!(reservations.some(r => r.roomNumber === reservation.roomNumber))) {
      reservations.push(reservation);
      return "La reservaci贸n de " + reservation.name + "se agrego correctamente";
    }

    const reviewCheckIn = convertDate(reservation.checkIn);
    const reviewCheckOut = convertDate(reservation.checkOut);
    reservations.forEach(r => {
      const checkIn = convertDate(r.checkIn);
      const checkOut = convertDate(r.checkOut);
      if (isOcupped(reviewCheckIn, reviewCheckOut, checkIn, checkOut)) {
        throw new Error("La habitaci贸n no esta disponible");
      } else {
        reservations.push(reservation);
      }
    });
    return "La reservaci贸n de " + reservation.name + "se agrego correctamente";  
  }
  function removeReservation(id) {
    let remove = reservations.find(reservation => reservation.id === id);
    if (remove) {
      reservations = reservations.filter(reservation => reservation.id !== id);
      return remove;
    } else {
      throw new Error("La reservaci贸n que se busca remover no existe");
    }
  }
  function getReservations() {
    return reservations;
  }
  function getAvailableRooms(checkIn, checkOut) {
    let list = [];
    checkIn = convertDate(checkIn);
    checkOut = convertDate(checkOut);

    for (let i = 1; i <= totalRooms; i++) {
      let reservation = reservations.find(r => r.roomNumber === i);
      if (!reservation) {
        list.push(i);
      } else {
        const filtered = reservations.filter(r => r.roomNumber === i);
        filtered.forEach(r => {
          const resCheckIn = convertDate(r.checkIn);
          const resCheckOut = convertDate(r.checkOut);
          if (!isOcupped(checkIn, checkOut, resCheckIn, resCheckOut)) {
            list.push(i);
          }
        });
      }
    }
    return list;
  }

  return {
    searchReservation,
    getSortReservations,
    addReservation,
    removeReservation,
    getReservations,
    getAvailableRooms
  }
}

Aqui mi respuesta! Gracias Dios!
Es curioso que sent铆 m谩s dificiles los temas de asincronismo xOx el uso de then y los async/await鈥
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  let reservations = [];
  let arrayRooms = [];
  let reservation;
  for (let index = 1; index <= rooms; index++) {
    arrayRooms.push(index)
  }
  return {
    searchReservation: function (id) {
      if (reservations.some(function (reservation) { return reservation.id == id })) {
        let result = reservations.find((item => item.id == id))
        return result
      } else {
        throw new Error("La reservaci贸n no fue encontrada");
      }
    },

    getSortReservations: function () {
      let sortedReservations = [...reservations];
      sortedReservations.sort(function (a, b) { return new Date(a.checkIn) - new Date(b.checkIn) })
      return sortedReservations
    },

    addReservation: function (reservation) {

      let sameRoomArray = reservations.filter(function (newReservation) {
        return newReservation.roomNumber == reservation.roomNumber;
      })

      if (sameRoomArray.length >= 1) {
        sameRoomArray.forEach(element => {
          if (new Date(element.checkIn) <= new Date(reservation.checkOut)
            && new Date(element.checkOut) >= new Date(reservation.checkIn)) {
            throw new TypeError('La habitaci贸n no est谩 disponible');
          }
          else { reservations.push(reservation); return "se registro con exito" }
        });
      } else { reservations.push(reservation); return "se registro con exito" }
    },

    removeReservation: function (id) {
      if (reservations.some((element => element.id == 1))) {

        let obj = reservations.find(item => (item.id == 1))
        let deletedReservation = reservations.splice(reservations.findIndex(
          function (element) { if (element.id == id) { return element } }), 1);
        return  obj ;

      } else {
        console.log("sad")
        throw new TypeError('La reservaci贸n que se busca remover no existe');
      }
    },
    getReservations: function () { return reservations },

    getAvailableRooms: function (checkIn, checkOut) {
      if (reservations.length > 0) {
        reservations.forEach(element => {
          if (new Date(element.checkIn) <= new Date(checkOut)
            && new Date(element.checkOut) >= new Date(checkIn)) {
            let index = arrayRooms.findIndex((item => item == element.roomNumber))
            arrayRooms.splice(index, 1);
          }

        })
        return arrayRooms;
      }
      else {
        return arrayRooms;
      }
    }
  }
}

Curiosamente este estuvo mucho m谩s dif铆cil que todos los anteriores, me toc贸 buscar inspiraci贸n en la soluci贸n para ciertas partes. Al menos aprend铆 algo nuevo hoy.
Spoiler:
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
    const reservations = [];

    function checkAvailability(reservation) {
        let status = true;

        reservations.map((ele) => {
            if (
                (reservation.checkIn >= ele.checkIn && reservation.checkIn < ele.checkOut) ||
                (reservation.checkOut > ele.checkIn && reservation.checkOut <= ele.checkOut) ||
                (reservation.checkIn <= ele.checkIn && reservation.checkOut >= ele.checkOut)
            ) {
                if (ele.roomNumber === reservation.roomNumber) {
                return status = false;
                };
            };
        });
  
      return status;
    };
  
    return{
        searchReservation: (id) => {
            let reservation = reservations.filter((ele) => ele.id === id);
    
            if(reservation[0]){
                return reservation[0];
            };
            
            throw new Error("La reservaci贸n no fue encontrada");
        },
      
        getSortReservations: () => {
            let sortedReservations = [...reservations].sort((a,b) => {
                return new Date(a.checkIn) - new Date(b.checkIn);
            });
    
            return sortedReservations;
        },
      
        addReservation: (reservation) => {
          if (!checkAvailability(reservation)) {
            throw new Error("La habitaci贸n se encuentra ocupada");
          }
      
          reservations.push(reservation);
          return `La reservaci贸n de ${reservation.name} fue agendada exitosamente`;
        },
      
        removeReservation: (id) => {
            let index = reservations.findIndex((ele) => ele.id === id);
    
            if(index > -1){
                let removedReservation = reservations[index];
                reservations.splice(index, 1);
                return removedReservation;
            }else{
                throw new Error("La habitaci贸n que se busca remover no existe");
            };
        },
      
        getReservations: () => {
          return reservations;
        },
      
        getAvailableRooms: (checkIn, checkOut) => {
          const availableRooms = [];
      
          for (let i = 1; i <= rooms; i++) {
            const reservation = { checkIn, checkOut, roomNumber: i };
      
            if (checkAvailability(reservation)) {
              availableRooms.push(i);
            }
          }
          return availableRooms;
        }
    }
}
  

Probablemente a alguien m谩s le sirva, esto me ayud贸 a entender un poco c贸mo organizar las fechas.

Los n煤meros del 1 al 30 simulan un mes
Los n煤meros rojos (5 al 20) simulan una reserva vieja
Los n煤meros verdes simulan una nueva reserva

Como ven, hay 4 casos posibles para la nueva reserva.

  1. Se puede encontrar compl茅tamente dentro de la reserva vieja (Grafico 1)
  2. Puede estar parcialmente dentro de la vieja reserva (Graficos 2 y 3)
  3. Puede encontrarse fuera de la vieja reserva (Grafico 4)
  4. La vieja reserva puede encontrarse completamente dentro de la nueva reserva

    Todos estos casos tenemos que tenerlos en cuenta a la hora de chequear la disponibilidad de una habitaci贸n

Hay un problema con la secci贸n de Habitaciones disponibles. No funcionan los input Date

Por alguna raz贸n utiliza los Date de Agregar Reservaci贸n

Estoy hace m谩s de una hora trabado con esto pensando que mi programa no funcionaba y acabo de darme cuenta 馃槪

Aporto mi soluci贸n.
Si se les dificulta calcular las fechas para saber si una habitaci贸n est谩 ocupada en la fecha elegida pueden usar la imagen que dej茅 como gu铆a en otro comentario
.
.
.
.
.
.
.
.
.
.
.

export function hotelSystem(rooms) {
  const cantHabitaciones = rooms
  const reservaciones = []

  //Creo una funci贸n para chequear si una habitaci贸n est谩 disponible. Esta funci贸n revisa que exista el n煤mero de habitaci贸n y no se encuentre ocupada en las fechas seleccionadas
  const chequearDisponibilidad = (reservation) => {
    if (reservation['roomNumber'] > cantHabitaciones || reservation['roomNumber'] < 1) {
      throw new Error('La habitaci贸n no existe')
    }
    return reservaciones.some(reservaGuardada => {
      //Chequeo que la habitaci贸n que voy a analizar concuerde con el n煤mero de habitaci贸n de la reservaci贸n que recib铆 por par谩metro
      return reservaGuardada['roomNumber'] === reservation['roomNumber'] && (

        //Si el checkIn de la nueva reservaci贸n se encuentra entre el checkIn de una vieja reserva y el checkOut de una vieja reserva, significa que la habitaci贸n est谩 ocupada
        (reservation['checkIn'] >= reservaGuardada['checkIn']
          &&
          reservation['checkIn'] <= reservaGuardada['checkOut'])

        ||

        //Si el checkOut de la nueva reservaci贸n se encuentra entre el checkIn de una vieja reserva y el checkOut de una vieja reserva, significa que la habitaci贸n est谩 ocupada
        (reservation['checkOut'] >= reservaGuardada['checkIn']
          &&
          reservation['checkOut'] <= reservaGuardada['checkOut'])

        ||

        //Si el checkIn de una vieja reserva se encuentra entre el checkIn de una nueva reserva y el checkOut de una nueva reserva, significa que la habitaci贸n est谩 ocupada
        (reservaGuardada['checkIn'] >= reservation['checkIn']
          &&
          reservaGuardada['checkIn'] <= reservation['checkOut'])
      )
    })
  }

  return {

    //Funci贸n de b煤squeda, retorna la reservaci贸n que concuerde con el id recibido por par谩metro
    searchReservation: (id) => {
      let busqueda = reservaciones.find(reservacion => reservacion['id'] === id)
      if (!busqueda) {
        throw new Error('La reservaci贸n no fue encontrada')
      }
      return busqueda
    },

    //Esta funci贸n ordena ascendentemente las reservaciones a partir de su fecha de checkIn, primero hace una copia del array de reservaciones y luego convierte la fecha de checkIn en un n煤mero eliminando la barra que separa el mes del d铆a (Ya que la fecha se almacena en formato mm/DD). y luego los compara. Guarda el array ordenado en "ordenadas" y lo retorna
    getSortReservations: () => {
      const ordenadas = reservaciones.slice().sort(
        (a, b) => parseInt(a['checkIn'].replace('/', '')) - parseInt(b['checkIn'].replace('/','')))
      return ordenadas 
    },

    //Esta funci贸n chequea la disponibilidad de la habitaci贸n, si existe y est谩 disponible la agrega al arreglo reservaciones. Si no est谩 disponible lanza un error
    addReservation: (reservation) => {
      const ocupada = chequearDisponibilidad(reservation)

      if (!ocupada) {
        reservaciones.push(reservation)
      } else {
        throw new Error('La habitaci贸n no est谩 disponible')
      }
      return "Reservaci贸n confirmada"
    },


    //Esta funci贸n ubica el 铆ndice de una reservaci贸n a partir de su ID, luego guarda esa habitaci贸n en una variable, ejecuta el m茅todo splice para eliminar la reservaci贸n y retorna la reservaci贸n. Si no existe lanza un error
    removeReservation: (id) => {
      let indexReserva = reservaciones.findIndex((reserva) => reserva['id'] === id)
      if (indexReserva >= 0) {
        let reserva = reservaciones[indexReserva]
        reservaciones.splice(indexReserva,1)
        return reserva
      } else {
        throw new Error('La reservaci贸n no existe')
      }
    },

    //Retorna el arreglo de reservaciones
    getReservations: () => {
      return reservaciones
    },

    //Ejecuta un for que va desde 1 hasta el m谩ximo de habitaciones para chequear su disponibilidad en las fechas elegidas. Las que est谩n disponibles se agregan al arreglo disponibles para ser retornadas
    getAvailableRooms: (checkIn, checkOut) => {
      const disponibles = []

      for (let i = 1; i <= cantHabitaciones; i++) {
        if (!chequearDisponibilidad(
          {
            'checkIn': checkIn,
            'checkOut': checkOut,
            'roomNumber': i
          }
        )) {
          disponibles.push(i)
        }
      }

      return disponibles
    }

  }
}
undefined