質問編集履歴

2

文法修正

2021/09/04 13:02

投稿

kgoa
kgoa

スコア4

test CHANGED
File without changes
test CHANGED
@@ -10,13 +10,13 @@
10
10
 
11
11
  const fruits =[
12
12
 
13
- {id: 0, title: apple, items: 3, condition: "good"},
13
+ {id: 0, title: "apple", items: 3, condition: "good"},
14
14
 
15
- {id: 1, title: orange, items: 5, condition: "good"},
15
+ {id: 1, title: "orange", items: 5, condition: "good"},
16
16
 
17
- {id: 2, title: kiwi, items: 1, condition: "Bad"},
17
+ {id: 2, title: "kiwi", items: 1, condition: "good"},
18
18
 
19
- {id: 3, title: cherry, items: 2, condition: "good"},
19
+ {id: 3, title: "cherry", items: 2, condition: "Bad"},
20
20
 
21
21
  ]
22
22
 
@@ -36,13 +36,13 @@
36
36
 
37
37
  const disposal =[
38
38
 
39
- {id: 0, title: apple, items: 3, condition: "Bad"},
39
+ {id: 0, title: "apple", items: 3, condition: "Bad"},
40
40
 
41
- {id: 1, title: orange, items: 5, condition: "Bad"},
41
+ {id: 1, title: "orange", items: 5, condition: "Bad"},
42
42
 
43
- {id: 2, title: kiwi, items: 1, condition: "Bad"},
43
+ {id: 2, title: "kiwi", items: 1, condition: "Bad"},
44
44
 
45
- {id: 3, title: cherry, items: 2, condition: "Bad"},
45
+ {id: 3, title: "cherry", items: 2, condition: "Bad"},
46
46
 
47
47
  ]
48
48
 
@@ -56,13 +56,13 @@
56
56
 
57
57
  const fruits =[
58
58
 
59
- {id: 0, title: apple, items: 3, condition: "good"},
59
+ {id: 0, title: "apple", items: 3, condition: "good"},
60
60
 
61
- {id: 1, title: orange, items: 5, condition: "good"},
61
+ {id: 1, title: "orange", items: 5, condition: "good"},
62
62
 
63
- {id: 2, title: kiwi, items: 1, condition: "Bad"},
63
+ {id: 2, title: "kiwi", items: 1, condition: "Bad"},
64
64
 
65
- {id: 3, title: cherry, items: 2, condition: "good"},
65
+ {id: 3, title: "cherry", items: 2, condition: "good"},
66
66
 
67
67
  ]
68
68
 
@@ -82,7 +82,7 @@
82
82
 
83
83
  items: fruits[index].itemes,
84
84
 
85
- condition: "Bad";
85
+ condition: "Bad",
86
86
 
87
87
  };
88
88
 

1

試行したことを追記

2021/09/04 13:02

投稿

kgoa
kgoa

スコア4

test CHANGED
File without changes
test CHANGED
@@ -50,6 +50,56 @@
50
50
 
51
51
 
52
52
 
53
+ ###試したこと
54
+
55
+ ```react
56
+
57
+ const fruits =[
58
+
59
+ {id: 0, title: apple, items: 3, condition: "good"},
60
+
61
+ {id: 1, title: orange, items: 5, condition: "good"},
62
+
63
+ {id: 2, title: kiwi, items: 1, condition: "Bad"},
64
+
65
+ {id: 3, title: cherry, items: 2, condition: "good"},
66
+
67
+ ]
68
+
69
+ console.log(fruits[0].title)
70
+
71
+ ///apple と出力
72
+
73
+
74
+
75
+ const disposal = fruits.map((index) => {
76
+
77
+ return {
78
+
79
+ id: [index],
80
+
81
+ title: fruits[index].title,
82
+
83
+ items: fruits[index].itemes,
84
+
85
+ condition: "Bad";
86
+
87
+ };
88
+
89
+ });
90
+
91
+
92
+
93
+ console.log(disposal)
94
+
95
+ ///出力失敗
96
+
97
+
98
+
99
+ ```
100
+
101
+
102
+
53
103
 
54
104
 
55
105
  ### 補足情報