I don't know what happened to the mentioned pr but tests are still broken. It thinks I've output something different that what I actually did. It insists that I duplicated some keys in the output but logging my return value shows that there was no duplicate values in my array...
This comment is hidden because it contains spoiler information about the solution
Fixed.
h
I don't know what happened to the mentioned pr but tests are still broken. It thinks I've output something different that what I actually did. It insists that I duplicated some keys in the output but logging my return value shows that there was no duplicate values in my array...
Yeah, that's an even more performant solution, as you don't have to spread out the final result or both arrays, just
c
.Though to be fair in my fork I just used
lodash
;)I would help you, but my javascript is not that good. In fact, somebody else made the javascript version of this. However, I will see what I can do.
This comment is hidden because it contains spoiler information about the solution
The JavaScript tests are pretty broken, I've made a fork that has a reference solution that actually follows the specifications.
BTW, using
includes
iterates an entire array, you'd do much better keeping it as a Set and usinghas
.