Advertisement
nikolayneykov92

Untitled

Jun 19th, 2019
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sum (arr) {
  2.   let sum = 0;
  3.   for (num of arr)
  4.     sum += Number(num);
  5.   return sum;
  6. }
  7.  
  8. const assert = require('chai').assert;
  9.  
  10. describe.only('sum', function () {
  11.   it('should return the sum of the values of all elements inside the array',
  12.     () => {
  13.       let numbers = [1, 2, 3];
  14.       let result = sum(numbers);
  15.       assert.strictEqual(result, 6);
  16.     })
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement