回答編集履歴
1
chousei
test
CHANGED
@@ -5,3 +5,17 @@
|
|
5
5
|
console.log(result);
|
6
6
|
|
7
7
|
```
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
ロジック的にはdataを一旦ソートしてObject.entries/valuesすると楽かも
|
12
|
+
|
13
|
+
```javascript
|
14
|
+
|
15
|
+
data.sort((x,y)=>x.month==y.month?(x.timestamp>y.timestamp?1:-1):x.month-y.month);
|
16
|
+
|
17
|
+
const result=Object.values(Object.fromEntries(data.map(x=>[x.month,x])));
|
18
|
+
|
19
|
+
console.log(result);
|
20
|
+
|
21
|
+
```
|