Hello. I am reviewing code written by Ayo Isaiah in his Medium article posted here: https://medium.freecodecamp.org/building-a-twitchtv-app-project-8824d61fe7a5
My question concerns the userHTML function which he calls in his fetchData function. He does not define the userHTML function at any point, so how does the DOM know to update itself using it?
Thank you for your assistance.
if (data.stream === null) {
url = data._links.channel.substr(38);
updateOfflineUsers();
}
else if (data.status == 422 || data.status == 404) {
status = data.message;
updateHTML(".unavailable");
}
else {
if (data.stream.channel.logo !== null) {
picture = 'url("' + data.stream.channel.logo + '")';
}
else {
picture = 'url("https://cdn.rawgit.com/ayoisaiah/freeCodeCamp/master/twitch/images/placeholder-2.jpg")';
}
url = data._links.channel.substr(38);
status = "<a href='https://twitch.tv/" + url + "' target='_blank'" + "'>" + data.stream.channel.display_name + "</a>" + " is currently streaming " + data.stream.game;
updateHTML(".online");
}
}