#Unit conversion

10 messages · Page 1 of 1 (latest)

trail dirge
#

I did the challenge to the best of my ability. But dissappointed in the following:

  • The input type is a number but it does not occupy a prominent position
  • The rounding of the decimals is erratic. Sometimes it works but most times not.

What did I do wrong? Please check my code. Thank you!

https://scrimba.com/learn/frontend/solo-project-pro-unit-converter-cz9aPNSr?a=215.0.1.L41_8

Scrimba

Learn to code with interactive scrims. Our courses and tutorials will teach you React, Vue, Angular, JavaScript, HTML, CSS, and more. Scrimba is the fun and easy way to learn web development.

wispy belfry
#

That's the lesson Scrim - you need to fork it to your own personal scrim for us to see what you wrote.

trail dirge
wispy belfry
trail dirge
#

In my CRIMß

keen quail
#

I think your issue with the decimal number rounding is that you're only rounding one of the arguments in the calculation.

here you're only rounding kiloToPound:
baseValue * kiloToPound.toFixed(3)

I think you can do this to round the sum of these two:
(baseValue * kiloToPound).toFixed(3)