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

276
Views
¿Cómo obtener y configurar el trabajo dentro de una función de construcción?

esta es la pregunta que recibí: use la palabra clave de clase para crear una clase de termostato. El constructor acepta una temperatura Fahrenheit. En la clase, cree un getter para obtener la temperatura en Celsius y un setter para establecer la temperatura en Celsius. Recuerda que C = 5/9 * (F - 32) y F = C * 9.0 / 5 + 32, donde F es el valor de la temperatura en Fahrenheit y C es el valor de la misma temperatura en Celsius.

el siguiente código es la respuesta, ¿puede explicar por qué necesito ese conjunto para convertir Celsius a Fahrenheit? porque solo tengo que emitir Celsius, no Fahrenheit

 class Thermostat { constructor(fahrenheit) { this.fahrenheit = fahrenheit; } get temperature() { return (5 / 9) * (this.fahrenheit - 32); } set temperature(celsius) { this.fahrenheit = (celsius * 9.0) / 5 + 32; } } const thermos = new Thermostat(76); // Setting in Fahrenheit scale let temp = thermos.temperature; // 24.44 in Celsius thermos.temperature = 26; temp = thermos.temperature; // 26 in Celsius
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!