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

124
Views
Cómo cambiar el nombre de una función en js por referencia o directamente

Quiero cambiar el nombre de una función directamente o por referencia.

Obviamente, un cambio de propiedad funciona cuando se usan objetos (o matrices):

 let object_1 = { some: "thing" }; let object_2; object_2 = object_1; object_2.some = "other"; console.log(object_2.some); // "other" console.log(object_1.some); // "other" --- because the change was translated to the object1 ///// also let array_1 = [ "some", "thing" ]; let array_2; array_2 = array_1; array_2[1] = "other"; console.log(array_2[1]); // "other" console.log(array_1[1]); // "other" --- because the change was translated to the array_1

Sin embargo, al intentar hacer lo mismo con las funciones, no funciona .

¿Entonces se supone que es function.name una propiedad intrínseca creada por la API de Javascript del navegador cuando la página html está 'incorporada' en ella y se vuelve inmutable ?

 let function_1 = function() { let a; return a = b + c; }; let function_2; function_2 = function_1; console.log(function_1.name); // "function_1" console.log(function_2.name); // "function_1" function_2.name = "newname"; console.log(function_2.name); // "function_1" --- ??? console.log(function_1.name); // "function_1" --- this somehow makes sense (but it's opposite to what happens to objects and arrays)
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!