Twitch---Why my code doesn't work?

Hi, I need help with twitch tv. What is wrong ? https://codepen.io/paulinafischer/pen/RgzbRX?editors=0010#0

I’m seeing a lot of little errors. You need to click on the little red exclamation point in the lower right corner and find the errors. When I click it it shows me an error (“unexpected string”) on line 18:

    $('#twitch').append(<'div class = "row text-left">' + ch.message +'</div>');

I think it is the first “<” in append, it needs to be inside the string, in other words

    $('#twitch').append('<div class = "row text-left">' + ch.message +'</div>');

Then on line 30, “unexpected token ‘)’”:

        $.("#online").append("<div class = "row text-left"><img class= "image" src = " + logo + "><a href = "+ link + "target="_blank">" + id +

It is getting confused by the period after the $ - it shouldn’t be there. When I fix that I get “unexpected identifier” - the problem is that you are using double quotes inside a double quote surrounded string. You can’t do that.

So far it’s just a lot of little errors. You need to work through them to get to the big issues.

Really, I think you should test more often. If this many errors are piling up, it says to me that you aren’t testing as you go.

Additionally, you need to indent and organize your code better to make it more readable. If all else fails, if you select all your code and to a shft-tab, most code editors will do a decent job auto-indenting, but you really should be doing this as you go, as this is part of the thought process.

1 Like