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

174
Views
Cambiar directamente y luego obtener una variable de cierre devuelta

En un cierre con variables internas, si devuelvo la variable en sí, puedo cambiar su valor directamente. Pero si agrego un captador al cierre, no genera el nuevo valor establecido. Pero si uso un setter, el getter genera el valor correcto. Cuando 'cambio' el valor de la variable devuelta, ¿qué estoy cambiando exactamente?

 function money(){ let usd=10; const getRate = () => usd; const setRate = (rate) => usd = rate; return {usd, getRate, setRate} } let m1 = money(); m1.usd = 20; console.log(m1.getRate()) // Returns 10 console.log(m1.usd) // Returns 20 m1.setRate(30); console.log(m1.getRate()) // Returns 30
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!