質問編集履歴

2

誤字修正

2019/10/15 02:36

投稿

teratailmacr2
teratailmacr2

スコア31

test CHANGED
File without changes
test CHANGED
@@ -68,7 +68,7 @@
68
68
 
69
69
  ["2019-12": [
70
70
 
71
- ["image": "", "price": "22", "name": "東京", "date": "2019-01-01 12:21:21"],
71
+ ["image": "", "price": "22", "name": "東京", "date": "2019-12-31 12:21:21"],
72
72
 
73
73
  ["image": "", "price": "21", "name": "千葉", "date": "2019-12-04 12:34:56"],
74
74
 

1

期待する結果を追記

2019/10/15 02:36

投稿

teratailmacr2
teratailmacr2

スコア31

test CHANGED
File without changes
test CHANGED
@@ -10,19 +10,19 @@
10
10
 
11
11
  let result = [
12
12
 
13
- ["image": "", "price": "22", "name": "東京", "date": "2019-01-01 12:21:21"],
13
+ ["image": "", "price": "22", "name": "東京", "date": "2019-12-31 12:21:21"],
14
14
 
15
- ["image": "", "price": "21", "name": "千葉", "date": "2015-03-04 12:34:56"],
15
+ ["image": "", "price": "21", "name": "千葉", "date": "2019-12-04 12:34:56"],
16
16
 
17
- ["image": "", "price": "20", "name": "埼玉", "date": "2017-11-23 08:01:58"],
17
+ ["image": "", "price": "20", "name": "埼玉", "date": "2019-11-23 08:01:58"],
18
18
 
19
19
  ["image": "", "price": "32", "name": "滋賀", "date": "2019-05-05 08:01:58"],
20
20
 
21
- ["image": "", "price": "33", "name": "京都", "date": "2018-10-10 08:01:58"],
21
+ ["image": "", "price": "33", "name": "京都", "date": "2019-04-10 08:01:58"],
22
22
 
23
- ["image": "", "price": "31", "name": "大阪", "date": "2017-09-10 08:01:58"],
23
+ ["image": "", "price": "31", "name": "大阪", "date": "2019-04-10 08:01:58"],
24
24
 
25
- ["image": "", "price": "30", "name": "兵庫", "date": "2019-12-12 08:01:58"],
25
+ ["image": "", "price": "30", "name": "兵庫", "date": "2018-12-12 08:01:58"],
26
26
 
27
27
  ]
28
28
 
@@ -55,3 +55,53 @@
55
55
 
56
56
 
57
57
  また、仮に上記のコードが上手く動くようになったとして、並び順が新しいもの順に保証された形にする事は可能なのでしょうか?
58
+
59
+
60
+
61
+ 期待する結果(よくわからないので形は適当です)
62
+
63
+
64
+
65
+ ```ここに言語を入力
66
+
67
+ let res = [
68
+
69
+ ["2019-12": [
70
+
71
+ ["image": "", "price": "22", "name": "東京", "date": "2019-01-01 12:21:21"],
72
+
73
+ ["image": "", "price": "21", "name": "千葉", "date": "2019-12-04 12:34:56"],
74
+
75
+ ],
76
+
77
+ ["2019-11": [
78
+
79
+ ["image": "", "price": "20", "name": "埼玉", "date": "2019-11-23 08:01:58"],
80
+
81
+ ],
82
+
83
+ ["2019-05": [
84
+
85
+ ["image": "", "price": "32", "name": "滋賀", "date": "2019-05-05 08:01:58"],
86
+
87
+ ],
88
+
89
+ ["2019-04": [
90
+
91
+ ["image": "", "price": "33", "name": "京都", "date": "2019-04-10 08:01:58"],
92
+
93
+ ["image": "", "price": "31", "name": "大阪", "date": "2019-04-10 08:01:58"],
94
+
95
+ ],
96
+
97
+ ["2018-12": [
98
+
99
+ ["image": "", "price": "30", "name": "兵庫", "date": "2018-12-12 08:01:58"],
100
+
101
+ ]
102
+
103
+ ]
104
+
105
+
106
+
107
+ ```