NEED HELP! Front end random quote machine

Hello guys. just finished with logic for the quote machine. i builded it with React. it seems for me that it works but need assictance to solve:

the test generator do not see that my quote changes and my author changing.
could you help me to find why?

also could you advise me. how to change the backgrounds with changing quotes. i store some with array but not sure what the logic should be.

Thats the link to the CodePen: https://codepen.io/Moiseychek/pen/XOwGVK

1 Like

Is a css variable the right track?

Thanks! its seems that it good now!

  1. You were reassigning to a const (you changed the code, I know).
#8 Uncaught TypeError: Assignment to constant variable.

Line: 37/38

const fon = document.body.style.backgroundColor;
fon = backgrounds[1];
  1. The property is background or backgroundImage. If you have 6 images in your image array you can use the same random number as used for the quote. Or you can just generate another random number in range of however many images you do have.

document.body.style.background = `url(${backgrounds[getRandomArbitrary]})`;

  1. fontawesome-iconpicker.min.js needs Jquery. You need to add Jquery before the script.

thats dope!!! Thank yoiu !! your are genius. im working on that to add it back ! thank you

No problem, just remember that the images have to work with https otherwise they won’t load. Happy coding.

1 Like