convert java to javascript
class Solution {
public int[] findingUsersActiveMinutes(int[][] logs, int k) {
int[] ans = new int[k];
Set<Integer> set = new HashSet<>();
Arrays.sort(logs, (a, b) -> a[0] - b[0]);
int x = logs[0][0];
for(int i=0; i<logs.length; i++) {
if(logs[i][0] != x) {
ans[set.size()-1]++;
set.clear();
}
x = logs[i][0];
set.add(logs[i][1]);
if(i==logs.length-1) {
ans[set.size()-1]++;
}
}
return ans;
}
}