Hi I'm having an issue getting a single item in a list. The list compromises of menu ids and I would like to get the specific id as opposed to the whole list.
Here is what I'm working with:
// list of menus ids
const select_menu_ids = ["menu1", "menu2" ];
// filter through the list seems to return the whole list instead of item in list
const ids = select_menu_ids.filter((menu_id) => menu_id);
// the statement that checks the id in the list
if (customId === `${ids}`) {...
CodePudding user response:
If what to want is to check is a customId
is inside the select_menu_ids
, your if
check should be something like this :
// list of menus ids
const select_menu_ids = [ "menu1", "menu2" ];
if (select_menu_ids.includes(customId)) { ... }