##Question response
Question response
I'd also like to know if this is a fair generator, or if it's more likely to get one shade than another. I don't see why it would, but you never know.
It seems fair to me... the random function returns "A floating-point, pseudo-random number"[1][1] so while the sequence could repeat, it might be very unlikely - refer to this SO answer for more of an explanation of that ... also read more about it in answers to this SO question: Will Math.random repeat?
##Feedback:
Feedback:
- good use of constants
- good use of arrow functions - e.g.
onclickfunction,onkeyupfunction
##Suggestions:
Suggestions:
use
constinstead ofletfor anything that doesn't change:randomNum, e.g.hexCode- refer to this answer for basisshorten the arrow function in onkeyup to use short-circuiting instead of
ifstatement:document.body.onkeyup = e => e.keyCode == 32 && applyColor();This tends to be faster, though it may seem less readable to some (see performance test here)