R
Reactiflux

help-js

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

LLaRynk10/31/2022
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}
]
LBLiil' Boo10/31/2022
@Rinkusu
eating.some((currentElement) => currentElement.newPosition ==== value);
eating.some((currentElement) => currentElement.newPosition ==== value);
Without information/context , I can only guess
LLaRynk10/31/2022
I want a one-liner check of "newPosition" for the value of "SELECTED_POS"
LBLiil' Boo10/31/2022
How am I supposed to know what is : 'SELECTED_POS' ?
LLaRynk10/31/2022
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
UUUnknown User10/31/2022
3 Messages Not Public
Sign In & Join Server To View

Looking for more? Join the community!