Jump to content
Sign in to follow this  
shaijuelayidath

Variable Logic of '123e5'

Recommended Posts

I have a doubt from the 'W3Schools' JS Tutorials, It is given below. The 'var y=123e5' produces 12300000.And 'var z=123e-5' produces 0.00123I did'nt understand what 'e5' and 'e-5' are stands for and how formed 12300000 from '123e5'and 0.00123 from '123e-5' ? The code given below. <script type="text/javascript">{var y=123e5;var z=123e-5;document.write(y+"<br/>"+z);}</script>

  • Like 1

Share this post


Link to post
Share on other sites

It's a short form of scientific notation used in floating point numbers. The e represents 10 elevated to the number that follows it. 5e6 is the same as 5 * 106 or 5 * 1,000,000 = 5,000,000

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×