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

163
Vistas
Parsing error: "," expected on conditional return

I really can get why, when I add a slice method to this function, i get a parsing error that needs a comma. Syntax looks correct to me. Any idea?

    const getObjectKeys = (object: any) => {
        Objeckt.keys(object).reduce((prevValue, value) => {
            if (value.startsWith("bo-")) {
                return { ...prevValue, value }
            } else {
                return { ...prevValue, value.slice(3) }
            }
        }, {})
    }
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You cannot do this return { ...prevValue, value.slice(3) }

Do this instead return { ...prevValue, value: value.slice(3) }

about 4 years ago · Juan Pablo Isaza Denunciar

0

you are missing the return keyword on outer function, and value key on last statement

    const getObjectKeys = (object: any) => {
        return Object.keys(object).reduce((prevValue, value) => {
            if (value.startsWith("bo-")) {
                return { ...prevValue, value }
            } else {
                return { ...prevValue, value: value.slice(3) }
            }
        }, {})
    }
about 4 years ago · Juan Pablo Isaza Denunciar
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