1.7 KiB
1.7 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7dab367417b2b2512b70 | Introduction to Currying and Partial Application | 1 | Введение в каррирование и частичное применение |
Description
undefined
Instructions
add
чтобы он использовал currying для добавления параметров x
, y
и z
. Tests
tests:
- text: ''
testString: 'assert(add(10)(20)(30) === 60, "<code>add(10)(20)(30)</code> should return <code>60</code>.");'
- text: <code>add(1)(2)(3)</code> должен вернуть <code>6</code> .
testString: 'assert(add(1)(2)(3) === 6, "<code>add(1)(2)(3)</code> should return <code>6</code>.");'
- text: <code>add(11)(22)(33)</code> должен вернуться <code>66</code> .
testString: 'assert(add(11)(22)(33) === 66, "<code>add(11)(22)(33)</code> should return <code>66</code>.");'
- text: 'Ваш код должен содержать заключительный оператор, который возвращает <code>x + y + z</code> .'
testString: 'assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g), "Your code should include a final statement that returns <code>x + y + z</code>.");'
Challenge Seed
function add(x) {
// Add your code below this line
// Add your code above this line
}
add(10)(20)(30);
Solution
// solution required