Given someArr
, (an array of php
timestamps, which will later be converted to javascript
timestamps (*=1000
)), I was expecting lodash
s...
_.sortedUniq(someArr)
to remove all duplicate values, giving the same result as
Array.from(new Set(someArr))
Could anyone explain why .sortedUniq()
doesn't remove duplicates? I also tried _.uniq()
, for that matter. Is my assumption wrong? Is there something wrong with my dataset?
Here's the mcve
.
The question itself refers to after I define allVals
, but I've left the way I'm constructing it in, just in case there's something wrong with how I'm doing that. The initial dataset array is what's coming from php
and, for the time being, is not negotiable in terms of structure.
Please note that, while I do have a bit of exercise in javascript
, I'm not a "schooled" programmer, I come from a design background and learned to code hands-on, so I'm not excluding the possibility that my grasp of certain programming patterns is not 100%
accurate.
Thorough explanations are highly appreciated.