I have been playing around with a pokemon API for a couple of days.
I have an array with all pokemon listed and have a string that looks something like this '<@user_id pidgeotto>'
I would like to check this string, against an array and get that EXACT name
My issue is that I ALSO get things that would be included, like pidgeot.
How can I match the array exactly to the string and ONLY log the one name?
let pokemonArray = ["pidgeot", "pidgeotto", "charizard", "goldeen"];
let y = '<@user_id> pidgeotto';
function handleMessage(message) {
for (let i = 0; i <= message.length; i++) {
if (y.includes(message[i])) {
console.log(message[i])
}
}
}
handleMessage(pokemonArray);
No errors, just not getting the result I am looking for.