--- title: Greatest common divisor id: 5a23c84252665b21eecc7e82 challengeType: 5 videoUrl: '' localeTitle: 最大公约数 --- ## Description
编写一个函数,返回两个整数的最大公约数。
## Instructions
## Tests
```yml tests: - text: gcd应该是一个功能。 testString: assert(typeof gcd=='function'); - text: 'gcd(24,36)应该返回一个数字。' testString: assert(typeof gcd(24,36)=='number'); - text: 'gcd(24,36)应该返回12 。' testString: assert.equal(gcd(24,36),12); - text: 'gcd(30,48)应该返回6 。' testString: assert.equal(gcd(30,48),6); - text: 'gcd(10,15)应该返回5 。' testString: assert.equal(gcd(10,15),5); - text: 'gcd(100,25)应该返回25 。' testString: assert.equal(gcd(100,25),25); - text: 'gcd(13,250)应该返回1 。' testString: assert.equal(gcd(13,250),1); - text: 'gcd(1300,250)应该返回50 。' testString: assert.equal(gcd(1300,250),50); ```
## Challenge Seed
```js function gcd(a, b) { // Good luck! } ```
## Solution
```js // solution required ``` /section>