Skip to content

Instantly share code, notes, and snippets.

@timcarl
Created March 28, 2018 00:54
Show Gist options
  • Save timcarl/c3c4c7b5c5d3f8a9800291c713abf59f to your computer and use it in GitHub Desktop.
Save timcarl/c3c4c7b5c5d3f8a9800291c713abf59f to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/wirorav
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[factorial on n!]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function foo(n) {
result = 1;
for ( var x = 0; x < n; x++) {
result = result * (n-1);
}
return result;
}
console.log(foo(0));
</script>
<script id="jsbin-source-javascript" type="text/javascript">function foo(n) {
result = 1;
for ( var x = 0; x < n; x++) {
result = result * (n-1);
}
return result;
}
console.log(foo(0));</script></body>
</html>
function foo(n) {
result = 1;
for ( var x = 0; x < n; x++) {
result = result * (n-1);
}
return result;
}
console.log(foo(0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment