8 lines
148 B
JavaScript
8 lines
148 B
JavaScript
|
var gcd = function(a, b) {
|
||
|
if ( ! b) {
|
||
|
return a;
|
||
|
}
|
||
|
|
||
|
return gcd(b, a % b);
|
||
|
};
|
||
|
console.log(gcd(2154, 458));
|