OKay so I am trying to implement this logic to my code, the idea is similar but the data is different
const populateJobs = async () => {
const data = await fetch("https://getlumen.com/_/lever");
const allJobs = await data.json();
const filteredJobs = allJobs.map((job) => {
return {
applyUrl: job.applyUrl,
team: job.categories.team,
text: job.text,
};
});
console.log(filteredJobs)
const final = Object.keys(filteredJobs.reduce((result, current) => {
const { team, applyUrl, text } = current;
result[team] ??= { team, info: [applyUrl, text] };
result[team].info.push(applyUrl, text);
return result;
}, {}));
console.log(final)
};
populateJobs();
You can run this in chrome console if you'd like
I get this result when I do so ( ss attached )
Although expected result is that all the items are categorised under team
just like age