arr
,它的返回值为这两个数字范围内所有数字(包含这两个数字)的最小公倍数。
注意,较小数不一定总是出现在数组的第一个元素。
比如,传入[1, 3]
,那么函数的返回结果应为 1、2、3 的最小公倍数,即为 6。
如果你遇到了问题,请点击帮助。
smallestCommons([1, 5])
应该返回一个数字。
testString: assert.deepEqual(typeof smallestCommons([1, 5]), 'number');
- text: smallestCommons([1, 5])
应该返回 60。
testString: assert.deepEqual(smallestCommons([1, 5]), 60);
- text: smallestCommons([5, 1])
应该返回 60。
testString: assert.deepEqual(smallestCommons([5, 1]), 60);
- text: smallestCommons([2, 10])
应该返回 2520。.
testString: assert.deepEqual(smallestCommons([2, 10]), 2520);
- text: smallestCommons([1, 13])
应该返回 360360。
testString: assert.deepEqual(smallestCommons([1, 13]), 360360);
- text: smallestCommons([23, 18])
应该返回 6056820。
testString: assert.deepEqual(smallestCommons([23, 18]), 6056820);
```