• 'filter' creates a new array + iterates through the total array.
    the 'reduce' solution stops when needed and returns a boolean.

  • I had the same problem. The tests feed back the output from your encode method to your decode method. So take a look at your encode method, especially the usage of javascript bitwise operations if you have them, like people have discussed below.

  • This solution is very elegant! It's so easily readable

  • Same problem here

  • This comment is hidden because it contains spoiler information about the solution

  • If the reference returned by report() is supposed to match the current values, not a snapshot, then the description needs to say this. Ideally with an example, e.g.

    var spied = spy(fn), report = spied.report();
    report.totalCalls === 0; // spied has not been called yet
    report.totalCalls === 1; // spied has been called once
    report.totalCalls === 2; // spied has been called twice
  • At first I thought report() method should return an immutable object. One whose totalCalls and log doesn't change after spied is called again after calling report(). I understood it as a "snapshot" from the time it is created (compare printed report).