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

95
Views
operación de propiedades de prototipo de javascript

Quiero agregar un parámetro de prototipo al objeto de JavaScript que devuelve una suma de otros parámetros.

¿Por qué funciona esto?:

 function Item() { this.a = 2; this.b = 3; this.c = this.a + this.b; } let it = new Item(); console.log(it.c); //5

Y esto no???:

 function Item() { this.a = 2; this.b = 3; } Item.prototype.c = this.a + this.b; console.log(it.c); // Nan

¿Cómo acceder a una propiedad para poder hacer operaciones en las propiedades de los prototipos?

¿O necesito declararlo siempre en el constructor del Objeto?

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!