
Franklin Gerardo Pimentel Hernández
PreguntaSi seria recomendable usar some() para validar si existe y luego usar find() o seria mejor usar find() directamente?

Fernando Deanda Ortiz
some() es solo para saber si contiene algún elemento que cumpla con la condición, si tu necesidad es recuperar N elementos y después trabajar sobre ellos entonces es mejor find()

Mauro Nava
Yo prefiero un
find
undefined
const list = [{id: 1}, {id: 2}] function GetItem (id=0) { const item = list.find(i => i.id === id) console.log(item || 'Item not found') return item } const exists = GetItem(1) // {id: 1} const notExists = GetItem(4) // undefined