2
Go to list of users who liked
5
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
①非同期処理をおこなう関数を宣言
const関数名=async()=>{constmessage='GitのユーザーIDは';consturl='https://api.github.com/users/taizo-pro'②awaitをつけ、fetchが実行完了するまで次に進まなくさせる
// jsonにreturnされた値が入るconstjson=awaitfetch(url).then(res=>{console.log('非同期処理成功時のメッセージです')returnres.json()}).catch(error=>{console.error('非同期処理失敗時のメッセージです。',error)returnnull});constusername=json.login;console.log(message+username)}関数名()Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
