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

168
Vistas
When setting up javascript composition function what is the correct way to create a method?
const barker = (state) => {
    bark: () => console.log('Woof, I am ' + state.name)
}

const barker2 = (state) => ({
    bark: () => console.log('Woof, I am ' + state.name)
})

barker===barker2 //returns false

My goal is to use Object.assign within a factory function and use 'barker' as an input. 'barker' doesn't work but 'barker2' works. Why does it work with the set of parenthesis? I understand IIFE's but this isn't immediately called so I don't understand what's happening here.

about 4 years ago · Santiago Gelvez
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