I am facing an issue where I am trying to display all values from the array "categories", but I keep getting [object object] or undefined. The problem seems to be occurring in the code within the last lines of the if statement, specifically when I try to call the "categories" array which seems to be of Object type.
const urlKeys = [...new URL(window.location.href).searchParams.keys()];
let categories = [];
let count = urlKeys.length;
for (let i = 0; i < count - 1; i++) {
categories.push({ type: paramsFromUrl.get('category' + i) })
} //This is where I populate the categories array
if (urlKeys[0] === 'allCategories') {
document.getElementById('notice').innerText = "All categories included: [" + categories + "]";
return viewsjs.createRestaurantCards(filterjs.findRestaurantsByCategory(await restaurantsjs.loadRestaurantsJSON(), categories));
} //The issue lies here