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

241
Views
Funciones de flecha en objeto literal frente a funciones de flecha en objetos generados por clase
const objectLiteral = { x: 5, getX: () => { console.log(`The value of x is ${this.x}`); } } x.getX(); // The value of x is undefined

¿Por qué this no se vincula con el método getX cuando uso un objeto literal? ¿La función de flecha no obtiene this del alcance principal? En este caso, el objectLiteral. Pero lo hace cuando uso un objeto generado por la clase.

 class classObject { x = 5; getX = () => { console.log(`The value of x is ${this.x}`); } const classObjectInstance = new classObject(); classObjectInstance.getX(); // The value of x is 5 }
about 4 years ago · Juan Pablo Isaza
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!