Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sum (arr) {
- let sum = 0;
- for (num of arr)
- sum += Number(num);
- return sum;
- }
- const assert = require('chai').assert;
- describe.only('sum', function () {
- it('should return the sum of the values of all elements inside the array',
- () => {
- let numbers = [1, 2, 3];
- let result = sum(numbers);
- assert.strictEqual(result, 6);
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement