* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
1.8 KiB
1.8 KiB
id, title, isRequired, challengeType, videoUrl, localeTitle
id | title | isRequired | challengeType | videoUrl | localeTitle |
---|---|---|---|---|---|
a97fd23d9b809dac9921074f | Arguments Optional | true | 5 | 参数可选 |
Description
addTogether(2, 3)
应返回5
, addTogether(2)
应返回一个函数。使用单个参数调用此返回函数将返回总和: var sumTwoAnd = addTogether(2);
sumTwoAnd(3)
返回5
。如果任一参数不是有效数字,则返回undefined。如果卡住,请记得使用Read-Search-Ask 。尝试配对程序。编写自己的代码。 Instructions
Tests
tests:
- text: '<code>addTogether(2, 3)</code>应该返回5。'
testString: assert.deepEqual(addTogether(2, 3), 5);
- text: <code>addTogether(2)(3)</code>应该返回5。
testString: assert.deepEqual(addTogether(2)(3), 5);
- text: '<code>addTogether("http://bit.ly/IqT6zt")</code>应返回undefined。'
testString: assert.isUndefined(addTogether("http://bit.ly/IqT6zt"));
- text: '<code>addTogether(2, "3")</code>应返回undefined。'
testString: assert.isUndefined(addTogether(2, "3"));
- text: '<code>addTogether(2)([3])</code>应返回undefined。'
testString: assert.isUndefined(addTogether(2)([3]));
Challenge Seed
function addTogether() {
return false;
}
addTogether(2,3);
Solution
// solution required