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

180
Views
'este' alcance en función regular frente a función de flecha

myRegFunc se refiere a this con un alcance local limitado al objeto de users . Sin embargo, myArrowFunc en su lugar se refiere a this con alcance global. ¿Hay alguna manera de hacer referencia a la this información en la función de flecha que está disponible en la función normal?

Entonces, ¿la función de flecha no puede vincularse con el local esto? Sin embargo, ¿es posible seguir obteniendo la información local a través de la global? Por ejemplo: global esto.algo.algo... = lo local esto.

 const users = { name: 'John', myRegFunc: function() { console.log('myRegFunc : ', this); }, myArrowFunc: () => console.log('myArrowFunc this: ', this), }; users.myRegFunc(); users.myArrowFunc();

Producción:

 myRegFunc : {name: 'John', myRegFunc: ƒ, myArrowFunc: ƒ} arrowFunc.js:34 myArrowFunc this: Window {window: Window, self: Window, document: document, name: '', location: Location, …}
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!