function gcd(p, q){ if(q == 0 ) return p var r = p % q return gcd(q, r) } var res = gcd(51,5) console.log(res)