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

106
Views
Supongamos que un objeto de clase tiene propiedades relacionadas, ¿hay una mejor manera de inicializar que codificar la relación?

Tengo una clase de presupuesto con una propiedad anual, mensual y semanal. ¿Hay una mejor manera de hacerlo que a continuación?:

 class Budget{ //based on choice, the initializer assigns, then calculates the two other properties constructor(value, choice) { this.value = value; this.choice = choice; this.annual = 0; this.monthly = 0; this.biweekly = 0; } initialize() { this.choice == 1 ? (this.annual = this.value, this.monthly = this.annual/12, this.biweekly = this.annual/52) : this.choice == 2 ? (this.monthly = this.value, this.annual = this.monthly*12, this.biweekly = this.annual/52): (this.biweekly = this.value, this.annual = this.biweekly*52, this.monthly = this.annual/12); } }
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!