✅ – 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}
]
LB
Liil' Boo535d ago
@Rinkusu
eating.some((currentElement) => currentElement.newPosition ==== value);
eating.some((currentElement) => currentElement.newPosition ==== value);
Without information/context , I can only guess
L
LaRynk535d ago
I want a one-liner check of "newPosition" for the value of "SELECTED_POS"
LB
Liil' Boo535d ago
How am I supposed to know what is : 'SELECTED_POS' ?
L
LaRynk535d 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
UU
Unknown User535d ago