我需要将then方法中的数据分配给全局变量才能使用它?
let request = async () => {
let response = await fetch( 'https://random-word-api.herokuapp.com//word?key=9889HYD5&number=100' );
let data = await response.json();
return data;
}
request()
.then( data => console.log(data) )
.catch( err => console.log(err) )