async function checkStreamStatus(channelName) {
const response = await fetch(`https://api.twitch.tv/helix/streams?user_login=${channelName}`, {
headers: {
'Authorization': 'Bearer ' + '',
'Client-Id': '',
}});
const json = await response.json();
const type = json.data[0]?.type;
status = type;
//console.log("worked " + status)
if (status === "live") {
return true;
}
else {
return false;
}
}
My brain couldn't handle how async function works even i watched 3 videos and spent 3 hours how can i return true and false from this function