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

181
Vistas
Arrow Function Created In An Object Returns undefined When Called Using .call() Method

i just created an object with an arrow function :

const user={
    fName:"0xN1nja",
    about:()=>{
        return this.fName;
    }
}

now, when i call that arrow function with .call() method, it returns undefined :

a=user.about.call(user);
console.log(a);
>>> undefined

But when i replaced that arrow function with a normal function expression, it returns the value

const user={
    fName:"0xN1nja",
    about:function(){
        return this.fName;
    }
}
a=user.about.call(user2);
console.log(a);
>>> 0xN1nja

what is happening here?

PS : im new to javascript

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Arrow functions don't bind to this as function do. That's one of the main reason they were introduced (probably the most important one).

You cannot even bind them.

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