Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create the mathematical number 1e6 in JavaScript?

How do I create the number 1e6 with JavaScript?

var veryLargeNumber = //1e6
like image 997
TheBrent Avatar asked Jun 28 '12 15:06

TheBrent


2 Answers

Here are some different ways:

var veryLargeNumber = 1e6;

var veryLargeNumber = 1.0e+06;

var veryLargeNumber = 1000000;

var veryLargeNumber = 0xf4240;

var veryLargeNumber = 03641100;

var veryLargeNumber = Math.pow(10, 6);
like image 128
Guffa Avatar answered Sep 21 '22 13:09

Guffa


It is written the way you wrote it: var notVeryLargeNumber = 1e6.

like image 27
Mahmoud Gamal Avatar answered Sep 19 '22 13:09

Mahmoud Gamal