Don't use jQuery utils (`$.each`, `$.map`, ...) please. We have `lodash` module for that stuff.
Here even better - since you know that `getDeletedFiles` will return an array you should use native implementation - `deletedFiles.forEach`