“Filtrar el objeto en la matriz utilizando dos argumentos” Código de respuesta

Filtrar el objeto en la matriz utilizando dos argumentos

var arr= [{id: "123", name: "Faa"},
          {id: "123", name: "Bar"},
          {id: "345", name: "Foo"},
          {id: "678", name: "FaaBar"}
         ];

var name = 'FaaBar';
var id = '678';

arr = arr.filter(function(elem) {
  //return false for the element that matches both the name and the id
  return !(elem.id == id && elem.name == name)
});
Cloudy Chipmunk

Cómo funciona la función filtre () 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

Filtrar matriz de objetos JS basada en múltiples parámetros

var arr= [{id: "123", name: "Foo"},
          {id: "123", name: "Bar"},
          {id: "345", name: "Foo"},
          {id: "678", name: "FooBar"}
         ];

var name = 'Foo';
var id = '123';

arr = arr.filter(function(elem) {
  //return false for the element that matches both the name and the id
  return !(elem.id == id && elem.name == name)
});
Vivacious Vendace

Respuestas similares a “Filtrar el objeto en la matriz utilizando dos argumentos”

Preguntas similares a “Filtrar el objeto en la matriz utilizando dos argumentos”

Más respuestas relacionadas con “Filtrar el objeto en la matriz utilizando dos argumentos” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código