Random Quote Machine -- Your feedback is appreciated!

Random Quote Machine -- Your feedback is appreciated!
0.0 0

#1

This project actually finished a couple of months ago, but I just joined FCC forum a few days ago and would like to know what you guys think of it. Any feedback is appreciated :smiley:

https://codepen.io/AdlanNur/full/wdjLzo


#2

Format your code better
Words in HTML attributes should be lower-case and separated with dashes
Don’t use ids for styling that’s what classes are for
Don’t chain variable declaration in javscript
Why are you putting $ before your variables?
Why no ES6?
Don’t use js animations, use CSS instead when possible
That’s not how to pass a callback function to a click handler, research the correct way to do it.


#3

Thanks for your response. I’ve edited some of my code with your suggestion in mind. However, there are a couple of things that I don’t fully understand.

Do you mean use .on method instead of .click method? If so, then why it is better to do that?

I’m not fully familiar with ES6 features, which part of my code that would be better using ES6?


#4

Event handlers

  $('#generate').on("click", function(){
    getQuote();
  });

You’re passing a function which passes a function. There is a way to pass getQuote directly, without using the anonymous function, let me know if you can’t figure it out.

ES6

I’d advise you to start using ES6 (and even ES7) features as much as possible. For your project specifically there won’t be a big benefit of using it, but keep in mind that these projects might end up in your portfolio when you are looking for work. Writing good, modern code is something that will help you get a job. Also, you’ll probably have to use ES6 on a daily basis when you do get a job, so you might as well get used to it.


#5

Ah, I see, thanks for pointing that out.