Skip to content

Commit c57b598

Browse files
authored
Merge pull request #640 from KenjiroAI/gcd-javascript
Add GCD for Javascript
2 parents 9764b65 + 4267b3e commit c57b598

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

gcd/javascript/gcd.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
function gcd(a, b) {
4+
if (b === 0) {
5+
return a;
6+
} else {
7+
return gcd(b, a % b);
8+
}
9+
}
10+
11+
console.log(gcd(36, 6));

0 commit comments

Comments
 (0)