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

177
Views
redondeo de números: calculadora de conversión de medidas métricas-imperiales / proyecto scrimba

Casi he terminado con un proyecto de calculadora de conversión de scrimba, pero no he tenido éxito con el redondeo de números a 3 decimales.

He jugado con math.round / math.floor sin éxito. ¡Cualquier sugerencia sera apreciada!

Aquí hay un fragmento de mi trabajo:

 let feetOutput = document.getElementById("feet-output"); let meterOutput = document.getElementById("meter-output"); meterInput = document.getElementById("meter-input"); let mainInput = document.getElementById("main-input"); litterInput = document.getElementById("litter-input") feetInput = document.getElementById("feet-input"); document.getElementById("main-Input").value = ''; document.getElementById("main-Input").textContent = 0; function lengthConverter(valNum) { document.getElementById("feet-output").innerHTML = valNum * 3.281 + " Feet"; document.getElementById("meter-output").innerHTML = valNum / 3.281 + " meters"; document.getElementById("gallons-output").innerHTML = valNum / 3.785 + " gallons"; document.getElementById("litter-output").innerHTML = valNum * 3.785 + " liters"; document.getElementById("pounds-output").innerHTML = valNum * 2.205 + " pounds"; document.getElementById("kg-output").innerHTML = valNum / 2.205 + " kilograms"; } function lengthConvertermf(valNum) { document.getElementById("feet-output").innerHTML = roundedUp((((valNum * 10) * (3.281 * 10)) / 10) * 1000 / 1000 + " Feet"); } function lengthConverterfm(valNum) { document.getElementById("meter-output").innerHTML = (((((valNum * 10) / (3.281 * 10) / 10) * 1000) / 1000) + " meters"); Math.round((num + Number.EPSILON) * 100) / 100 } function lengthConverterlg(valNum) { document.getElementById("gallons-output").innerHTML = roundedUp(valNum / 3.785 + " gallons"); } function lengthConvertergl(valNum) { document.getElementById("litter-output").innerHTML = roundedUp(valNum * 3.785 + " liters"); } function lengthConverterkp(valNum) { document.getElementById("pounds-output").innerHTML = roundedUp(valNum * 2.205) + " pounds"; } function lengthConverterpk(valNum) { document.getElementById("kg-output").innerHTML = roundedUp(valNum / 2.205 + " kilograms"); }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 const round = (num, n) => Number.parseFloat(num.toFixed(n)); //using: console.log(round(3.14159, 3)); const floor = (num, n) => Number.parseFloat(num.toFixed(n)) - Math.pow(10, -n);

about 4 years ago · Juan Pablo Isaza Report
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!