lleexx,
всё нормально тестируется.
Пример: Solution:
function createArithmetic(from)
{
if (!Number.isInteger(from)) {
throw new Error('Invalid from argument');
}
return function(to) {
if (!Number.isInteger(to)) {
throw new Error('Invalid to argument');
}
return (from + to) / 2 * (Math.abs(from - to) + 1);
}
}
var summation = createArithmetic(1);