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

149
Views
Quiero hacer que una función sea más reutilizable mediante el uso de un almacén de nombres de variables dentro de un parámetro de función. ¿Como podría hacerlo?

Quiero hacer que una función sea más reutilizable al poder darle un nombre de variable y modificar el valor de esa variable dentro de la función de esa variable.

Algo así:

 var number1; function one(){ number1 = 10; two(number1); } function two(varname){ varname = varname * 10; }

¿Cómo puedo hacer eso?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si envía la variable como una cadena, puede hacer referencia a ella usando this

 var number1; function one(){ number1 = 10; two("number1"); } function two(varname){ this[varname] = this[varname] * 10; } one() console.log(number1)

about 4 years ago · Juan Pablo Isaza Report
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!