Passes test 1 and 2 from exercise 05
This commit is contained in:
parent
a308d40fee
commit
43e2839177
|
@ -1,5 +1,9 @@
|
||||||
const sumAll = function() {
|
const sumAll = function(a, b) {
|
||||||
|
let sum = 0;
|
||||||
|
for (let i = a; i <= b; i++) {
|
||||||
|
sum += i;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe('sumAll', () => {
|
||||||
test('sums numbers within the range', () => {
|
test('sums numbers within the range', () => {
|
||||||
expect(sumAll(1, 4)).toEqual(10);
|
expect(sumAll(1, 4)).toEqual(10);
|
||||||
});
|
});
|
||||||
test.skip('works with large numbers', () => {
|
test('works with large numbers', () => {
|
||||||
expect(sumAll(1, 4000)).toEqual(8002000);
|
expect(sumAll(1, 4000)).toEqual(8002000);
|
||||||
});
|
});
|
||||||
test.skip('works with larger number first', () => {
|
test.skip('works with larger number first', () => {
|
||||||
|
|
Loading…
Reference in New Issue