I want to make a function that takes an entered value and converts it to scientific notation (N x 10^a)
I've tried many different things, but I can't seem to get it right.
Example:
I enter 200. The converter converts it to 2 x 10^2
Scientific notation is a way to make these numbers easier to work with. In scientific notation, you move the decimal place until you have a number between 1 and 10. Then you add a power of ten that tells how many places you moved the decimal. In scientific notation, 2,890,000,000 becomes 2.89 x 109.
You can do something like this:
a = 200 a.toExponential(); //output 2e+2
fiddle: http://jsfiddle.net/Q8avJ/9/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With