“Saring array” Kode Jawaban

Filter JavaScript Array

var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length > 6);

console.log(result);
White Browed Owl

filter dalam fungsi 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(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'
})
Sab Tech

.Filter JS

const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length > 6);

console.log(result);
// expected output: Array ["exuberant", "destruction", "present"]
Difficult Dolphin

Bagaimana fungsi filter () bekerja javascript

const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];

const filter = arr.filter((number) => number > 5);
console.log(filter); // [6, 7, 8, 9]
DCmax1k

Filter Array JavaScript

var numbers = [1, 3, 6, 8, 11];

var lucky = numbers.filter(function(number) {
  return number > 7;
});

// [ 8, 11 ]
Two Toed Tree Sloth

Saring array

const filteredArray = array.filter(element => element.id != id))
Didi Abel

Jawaban yang mirip dengan “Saring array”

Pertanyaan yang mirip dengan “Saring array”

Lebih banyak jawaban terkait untuk “Saring array” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya