Bug in functional-javascript program- project 2, week 6

#1

I think I have found a bug in the recursion exercise. We are supposed to recreate the reduce higher order function using recursion. To make sure that it works, verify uses the test and function from the reduce exercise. It inputs an array of strings, and outputs an object with the strings as keys and their respective counts as values. Ex reduce([‘a’, ‘b’ ,‘a’], fn, {}) === { a: 2, b: 1 }

If I make a reduce function which always returns an empty object, the verify test behaves appropriately.

function reduce(arr, fn, initial) {
  return {};
}

input:      [ 'consequat', 'ex', 'adipisicing', 'ea', 'ex', 'qui', 'laborum', 'cillum', 'officia', 'elit', 'non', 'officia', 'duis', 'id', 'aute', 'excepteur', 'ea', 'ipsum', 'lorem', 'ut', 'aute', 'incididunt', 'elit', 'ex', 'laboris', 'aliquip', 'esse', 'consectetur', 'aliqua', 'aliquip', 'proident', 'veniam', 'aute', 'est', 'laborum', 'sit', 'mollit', 'non', 'enim', 'elit', 'commodo', 'et', 'sint', 'ea', 'exercitation', 'duis', 'dolore', 'reprehenderit', 'deserunt', 'ad' ]
submission: {}
solution:   { consequat: 1, ex: 3, adipisicing: 1, ea: 3, qui: 1, laborum: 2, cillum: 1, officia: 2, elit: 3, non: 2, duis: 2, id: 1, aute: 3, excepteur: 1, ipsum: 1, lorem: 1, ut: 1, incididunt: 1, laboris: 1, aliquip: 2, esse: 1, consectetur: 1, aliqua: 1, proident: 1, veniam: 1, est: 1, sit: 1, mollit: 1, enim: 1, commodo: 1, et: 1, sint: 1, exercitation: 1, dolore: 1, reprehenderit: 1, deserunt: 1, ad: 1 }

# FAIL

/* Your solution to Basic: Recursion didn't pass. Try again! */

If I make a working reduce function, verify shows that I have submitted a filled object, when both the input and output are empty.

function reduce(arr, fn, initial) {
  if (arr.length > 0) {
    const result = fn(initial, arr[0]);
    arr.shift();
    return reduce(arr, fn, result);
  }
  return initial;
}

input:      []
submission: { proident: 3, aliquip: 1, quis: 2, id: 1, duis: 1, do: 2, ipsum: 1, laborum: 2, enim: 1, ex: 1, officia: 2, consequat: 1, exercitation: 2, labore: 1, cillum: 1, dolor: 2, cupidatat: 1, ut: 1, consectetur: 1, velit: 3, in: 1, ullamco: 1, qui: 1, incididunt: 1, elit: 2, adipisicing: 1, deserunt: 1, veniam: 1 }
solution:   {}

# FAIL

Your solution to Basic: Recursion didn't pass. Try again!

How is this possible?