“Encontre na função da matriz” Respostas de código

Encontre na função da matriz

const persons = [
  {name:"Shirshak",gender:"male"},
  {name:"Amelia",gender:"female"},
  {name:"Amand",gender:"male"}
]
//filter return all objects in array
let male = persons.filter(function(person){
return person.gender==='male'
})
console.log(male) //[{name:"Shirshak",gender:"male"},{name:"Amand",gender:"male"}]

//find return first object that match condition
let female = persons.find(function(person){
return person.gender==='female'
})
Shirshak kandel

Encontre toda a matriz que satisfaz a condição JavaScript

myArray.filter(x => x > 5)
Thoughtless Turkey

Encontre em JS

The first element that will be found by that function
const f = array1.find(e => e > 10);
EON

Respostas semelhantes a “Encontre na função da matriz”

Perguntas semelhantes a “Encontre na função da matriz”

Mais respostas relacionadas para “Encontre na função da matriz” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código