filter array javascript dengan beberapa id
let itemsids = [1,45,7.4]
const result = data.items.filter((e) => itemsids.includes(e.id))
Aashiq Hasnat
let itemsids = [1,45,7.4]
const result = data.items.filter((e) => itemsids.includes(e.id))
// use .filter and write multiple validations in the callback function
let numbers = [3, 7, 2, 15, 4, 9, 21, 14];
let filteredNumbers = numbers.filter(function (currentElement) {
if (currentElement > 3 && currentElement < 17) {
return true;
}
});
console.log(filteredNumbers);