Linted and replaced array.map polyfill with the proper version from MDN

Removed trailing commas, added semis where appropriate, and replaced the array.map polyfill with the "official" version from MDN -- apparently the version used here previously was not the proper and complete implementation.
It doesn't fix a bug, but sortFunction is undefined at this place in the code, so the logic isn't valid -- I can stick that in a separate PR if you want, or just break up the commits.