Ad
const input = ["a", 1, 2, false, "b"];
const output = input.reduce((acc, el) => {
  const type = typeof el;
  acc[type] = acc[type] || [];
  acc[type].push(el);
  return acc;
}, {});
console.log(output);