回答編集履歴
2
ちょうせい
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
window.addEventListener('DOMContentLoaded',async()=>{
|
6
6
|
|
7
|
-
const res=await fetch("
|
7
|
+
const res=await fetch("sample.json")
|
8
8
|
|
9
9
|
.then(x=>x.json())
|
10
10
|
|
1
ちょうせい
test
CHANGED
@@ -1,13 +1,21 @@
|
|
1
1
|
```javascript
|
2
2
|
|
3
|
-
|
3
|
+
<script>
|
4
4
|
|
5
|
-
|
5
|
+
window.addEventListener('DOMContentLoaded',async()=>{
|
6
6
|
|
7
|
+
const res=await fetch("x.json")
|
8
|
+
|
7
|
-
|
9
|
+
.then(x=>x.json())
|
10
|
+
|
11
|
+
.then(x=>[...new Set(x.map(x=>Object.values(x)).flat())]);
|
12
|
+
|
13
|
+
res.forEach(x=>document.querySelector('.categorylist').innerHTML+=`<li>${x}</li>`);
|
8
14
|
|
9
15
|
})()
|
10
16
|
|
17
|
+
</script>
|
11
18
|
|
19
|
+
<div class="categorylist"></div>
|
12
20
|
|
13
21
|
```
|