退会済みユーザー
2021/06/13 11:46 編集
.
JavaScript
1'use strict'; 2 3fetch('https://www.jma.go.jp/bosai/forecast/data/overview_week/130000.json') 4 .then((response) => { 5 console.log(response); 6 console.log(response.status); 7 console.log(Object.keys(response)); 8 console.log(JSON.stringify(response)); 9 return response.json(); 10 }) 11 .then((json) => { 12 console.log(json); 13 });
上記の1つ目の then() に渡したコールバック関数の引数 response は少なくとも status というキーを持つはずなのですが 、Object.keys(response) と JSON.stringify(response) の結果が空配列や空オブジェクトになってしまいます。
これはなぜなのでしょうか。ご教示いただければ幸いです。
回答1件
あなたの回答
tips
プレビュー