Some feedback for the code of my ulgy random quote machine

Some feedback for the code of my ulgy random quote machine
0

#1

I “think” that is already done, but some of the quotes are to large for a tweet, so, im going to put and “if” if the length of the quote is above 140 characters the user not gonna be able to tweet, any other thing maybe latter.

So… if you’re not bussy, can you give me some feedback on the code of my machine please: https://codepen.io/FelixJMaxwell/pen/Pmjwzm

PD: sorry for make you’re eyes crying with my english, i always put this just in case :stuck_out_tongue:


#2

It looks good, and if ugly is what you wanted, then you nailed it, :wink:

The only issue I saw was that when I tried to Tweet the quote, there was a carriage return before the double quote at the end of the “quote”. It looks like that is what the API is sending you. Also, the quote seems to be wrapped in html tags - strange.

But I think you can fix the carriage return problem by adding a trim() to your Tweet function:

 $("#twitter-btn").attr('href', 'https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote.trim() + '" ' + currentAuthor.trim()));

Also, be sure to use proper indenting. As a help, most code editors will help you out - if you select all the code, and hit shift-tab, it will try to auto indent everything correctly.

But good job.


#3

I thought the carriage return was normal, but no the " end in the next line, didn’t know about “shift-tab” thanks for the advice :slight_smile: