LaRynk
LaRynk2y ago

✅ – Axel (Rinkusu) – 08-39 Oct 31

Hi, how can I check if a value is one of the "newPosition" please ?
eating: [
{newPosition: -18, checkEnemy: -9},
{newPosition: -14, checkEnemy: -7}
]
eating: [
{newPosition: -18, checkEnemy: -9},
{newPosition: -14, checkEnemy: -7}
]
6 Replies
liil'boo
liil'boo2y ago
@Rinkusu
eating.some((currentElement) => currentElement.newPosition ==== value);
eating.some((currentElement) => currentElement.newPosition ==== value);
Without information/context , I can only guess
LaRynk
LaRynk2y ago
I want a one-liner check of "newPosition" for the value of "SELECTED_POS"
liil'boo
liil'boo2y ago
How am I supposed to know what is : 'SELECTED_POS' ?
LaRynk
LaRynk2y ago
it was just a number, a position, because I'm looking for a "newPosition", and you see "newPosition"s. anyway I found a solution with reduce
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1036560036035571742
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1036560036035571742 Question not getting answered? Maybe it's hard to answer, or maybe you asked at a slow time. Check out these resources for help asking a good question: https://stackoverflow.com/help/how-to-ask http://wp.me/p2oIwo-26