Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
Vuelva a ejecutar la matriz filtrada que no es igual a otra lista de matrices

Tengo una API con una lista de autos.

 const getAsset = async () => dbApi('list_cars', ['', 100]) .then(result => result.map(e => e.symbol));

aquí, getAsset devuelve la lista de autos.

 0: "BMW" 1: "HONDA" 2: "SCODA" 3: "STAR" 4: "PETH" 5: "TEST" 6: "TESLA"

En el siguiente bloque de código, intenté devolver la lista excluyendo BMW . Y funcionó bien.

 const getAsset = async () => dbApi('list_cars', ['', 100]) .then(result => result.filter(e => e.symbol != 'BMW' ).map(a => a.symbol));

Ahora, quiero seguir adelante y devolver la lista de autos excluyendo BMW , HONDA y TEST .

 const expect = ['BMW','HONDA','TEST'];

Resultado Esperado :

 0: "SCODA" 1: "STAR" 2: "PETH" 3: "TESLA"

¿Qué cambios debo hacer en el bloque de código anterior?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Puedes hacerlo por método de filter , así:

 const cars = ["BMW","HONDA", "SCODA", "STAR", "PETH", "TEST", "TESLA"] const except = ["BMW","HONDA","TEST"]; const filteredCars = cars.filter(car => !except.includes(car)); console.log(filteredCars)

about 4 years ago · Juan Pablo Isaza Report

0

 const getAsset = async () => dbApi('list_cars', ['', 100]) .then(result => result.filter(e => (e.symbol != 'BMW' && e.symbol != 'HONDA' && e.symbol != 'TEST') ).map(a => a.symbol));

about 4 years ago · Juan Pablo Isaza Report

0

 const cars = ["BMW","HONDA", "SCODA", "STAR", "PETH", "TEST", "TESLA"]; const filteredResult = cars.filter(e => (e != 'BMW' && e != 'HONDA' && e != 'TEST')); console.log(filteredResult);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!