Reactiflux
Reactiflux

help-js

Root Question Message

Axel (Rinkusu)
Axel (Rinkusu)10/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}
]
Liil' Boo
Liil' Boo10/31/2022
@269824456409481216
eating.some((currentElement) => currentElement.newPosition ==== value);


Without information/context , I can only guess
Axel (Rinkusu)
Axel (Rinkusu)10/31/2022
I want a one-liner check of "newPosition" for the value of "SELECTED_POS"
Liil' Boo
Liil' Boo10/31/2022
How am I supposed to know what is : 'SELECTED_POS' ?

Solution Message

Axel (Rinkusu)
Axel (Rinkusu)10/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
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy