Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript filter elements in array

const persons = [
  {name:"Shirshak",gender:"male"},
  {name:"Amelia",gender:"female"},
  {name:"Amand",gender:"male"}
]
//filter return all objects in array
let male = persons.filter(person=>person.gender==='male')
console.log(male)
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #filter #elements #array
ADD COMMENT
Topic
Name
7+3 =