What does "2e4" mean in code

This example http://raphaeljs.com/gear.html has the following code:

function run() { e.animate({along: 1}, 2e4, function () { e.attr({along: 0}); setTimeout(run); }); } 

What does β€œ2e4” mean in this example and how does it work?

+6
source share
2 answers

it means 2 * 10 ^ 4
and try in console 2e4 output will be 20000

e is scientific notation

code is equivalent

 ... e.animate({along: 1}, 20000, function () { .... 
+9
source

2e4 scientific notation for 2 * 10^4 and therefore has the same meaning as 20,000.

+4
source

Source: https://habr.com/ru/post/943598/


All Articles