Finding Common Items in arrays
Overall looks good. I think following improvements can be suggested.

1.Instead of this

typeof ids[statementId] === "undefined"
  ? (ids[statementId] = 1)
  : ids[statementId]++;


How about this for more readability

ids[statementId] = (ids[statementId] || 0) + 1;


2.Instead of doing sort and immediately reverse. You can change sort function (with descending order) so that you can avoid reverse call.