Last active
October 23, 2017 08:28
-
-
Save rick4470/9b2720557d5833c305ea to your computer and use it in GitHub Desktop.
Calculating e (mathematical constant) with javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var eValue = 0; | |
| for(var i=0; i< Infinity; i++){ | |
| if(i==18) break; | |
| var fact = 1; | |
| for(var j=1; j<= i; j++){ | |
| fact = fact * j; | |
| } | |
| eValue += (1/fact); | |
| } | |
| console.log(eValue); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment