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

137
Views
¿Por qué la nueva clave se muestra diferente cuando usamos Object.defineProperty() en javascript?

En este ejemplo a continuación (fuente: W3school ), cuando colocamos console.log('person',person); al final, fullName está en un color diferente en el registro de los demás ( ver la imagen ). ¿Significa que el fullname es temporal? ¿Qué debo hacer para que se convierta en parte de la person ?

PD: soy principiante y no puedo poner fotos aquí. ¡gracias por entender!

 <!DOCTYPE html> <html> <body> <h2>JavaScript Object.defineProperty()</h2> <p>This example uses the defineProperty() method to add a getter and a setter.</p> <p id="demo"></p> <script> // Create an object: const person = {firstName:"John", lastName:"Doe"}; // Define a getter Object.defineProperty(person, "fullName", { get: function () {return this.firstName + " " + this.lastName;} }); console.log('person',person); // Display full name document.getElementById("demo").innerHTML = person.fullName; </script> </body> </html>
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!