Ad
Code
Diff
  • function numMinusSeven(num) {
      const arr = [];
      for (let i = num; i > 0; i -= 7) {
        arr.push(i - 7);
      }
      return arr.length;
    };
    
    //The function counts iterations until num is => 0;
    
    • function numMinusSeven(num) {
    • let sssss = []
    • while (num > 0) {
    • num -= 7
    • sssss.push(num)
    • }
    • return sssss.length
    • }
    • const arr = [];
    • for (let i = num; i > 0; i -= 7) {
    • arr.push(i - 7);
    • }
    • return arr.length;
    • };
    • //The function counts iterations until num is => 0;
Code
Diff
  • const addArr = (arr) => {
      let sum = 0;
      arr.forEach(num => {
      sum += num;
    });
      return sum || null;
    };
    
    
    • const addArr = (arr) => {
    • let sum = 0;
    • for (let i = 0; i < arr.length; i++) {
    • sum += arr[i];
    • }
    • arr.forEach(num => {
    • sum += num;
    • });
    • return sum || null;
    • };