Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
I'm trying to use reduce high order function in my javascript code but keeps giving me #<Object> not a function

I'm doing an assignment using javascript language for educational purposes, but i'm a beginner. I'm having some problems trying to use reduce function.

What i'm trying to do is to use reduce to filter the following.

"Receive a string array in propNames and an object array in objs. Return a new object array with objects produced by applying the filterProperties function with propNames to each object in objs."

I already code filterProperties and its working fine to match propNames with only one object. I leave the code down below:

function filterProperties(propNames, obj) {
    let output = {}
    let objKeys = Object.keys(obj);
    const matchingElems = propNames.sort().filter(elem => objKeys.includes(elem))
    matchingElems.forEach(elem => output[elem] = obj[elem])
    return output
}

So just to sum up, i would like to use reduce to iterate and output an array with the properties matching propNames and objs.

My code is not working, i'm a complete beginner and I didn't understand well how to use reduce function. I leave my code below, so that anyone can help me solving this issue.

function filterPropertiesN(propNames,objs) {
    objs.reduce(filterProperties(propNames, objs))
 }

many thanks in advance!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda