JS function for turning an Array into a set (a plain JS object with keys pointing to `true`)