Skip to content

Instantly share code, notes, and snippets.

@rick4470
Last active October 23, 2017 08:28
Show Gist options
  • Select an option

  • Save rick4470/9b2720557d5833c305ea to your computer and use it in GitHub Desktop.

Select an option

Save rick4470/9b2720557d5833c305ea to your computer and use it in GitHub Desktop.
Calculating e (mathematical constant) with javascript
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