Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have array
Game: [ { game: 'SS', status: 2 }, { game: 'CD', status: 2 }, { game: 'AS', status: 2 }, { game: 'SM', status: 2 }, { game: 'GTA', status: 1 }, ]
how can I find the GTA's status is equal to 1 using find method in js?
const foundGame = Game.find(({ status }) => status === 1)
find
Game.find(game => game.status===1)
Add a comment
You can use filter method:
filter
const games = Game.filter(gta => gta.status == 1 );
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
const foundGame = Game.find(({ status }) => status === 1)?findhas several examples. What part of those are you not understanding?