Twitch TV Project feedback

Hi Everyone,

First off, I cannot thank everyone enough for all the help and feedback during my journey with FCC. Below is the link to my Twitch tv project. I would like to get some feedback. Any and all feedback is welcomed.

Thank you in advance!

What I like:
Great work in completing the challenge. Congrats.

  • URLs are at the top of the program and can easily be customized
  • Easy to change and add new channels in the channelArr object
  • CSS definitions are good

How to improve the code:

  • Use the tidy js feature to format your code.
  • Break up the code into functions. Each function will do small amount of work.

Take some time to refactor your code, JavaScript Refactoring Techniques:
and Refactoring JavaScript: Turning Bad Code into Good Code

In the following section of code, I think your class names ‘online’ and ‘offline’ are switched. Or maybe you decided to change the CSS class instead to make it work.

          success: function(data1) {
            logo = data1.logo;
            chName = data1.display_name;
            chUrl = data1.url;

            if (data.stream === null) {
              status = "<div id='row1' class='row online'>"; // shouldn't this be class of 'offline'?
              description = "Offline";
            } else {
              status = "<div id='row1' class='row offline'>";
              description = data.stream.channel.status; // // shouldn't this be class of 'offline'?
            }

Also, you have an error showing in your console, because you added jQuery-ui before adding jQuery in your Codepen external JavaScript files section.

Thank you for the feedback! I fixed the css for the online/offline issue and corrected the jquery error :slight_smile:

Thanks roxroy! I will definitely try to add more functions and break things up. As for tidy js, i have never heard of it. I will look into it.

Each Codepen module (HTML, CSS, and JS) have a Tidy feature (under the dropdown on the right of each module image) which will attempt to indent your code.

1 Like