teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

chousei

2021/09/29 04:02

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -7,4 +7,15 @@
7
7
  console.log(result);
8
8
  })();
9
9
  ```
10
- 微調整
10
+ 微調整
11
+
12
+ Lhankor_Mhyさんのご指摘をうけて
13
+ ```javascript
14
+ <script type="module">
15
+ let result=[];
16
+ const getCSV=()=>fetch('sample.csv').then(res=>res.text()).then(csvArray);
17
+ const csvArray=str=>str.split("\r\n").map(x=>x.split(","));
18
+ result=await getCSV();
19
+ console.log(result);
20
+ </script>
21
+ ```

1

微調整

2021/09/29 04:02

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -1,9 +1,10 @@
1
1
  ```javascript
2
- const getCSV=async()=>fetch('sample.csv').then(res=>res.text()).then(csvArray);
2
+ const getCSV=()=>fetch('sample.csv').then(res=>res.text()).then(csvArray);
3
- const csvArray=(str)=>str.split("\r\n").map(x=>x.split(","));
3
+ const csvArray=str=>str.split("\r\n").map(x=>x.split(","));
4
4
 
5
5
  (async ()=>{
6
6
  const result=await getCSV();
7
7
  console.log(result);
8
8
  })();
9
- ```
9
+ ```
10
+ 微調整