Awesome, i alway want to combine tech with art, this is a cool way, thank you so much
@julsh_3 жыл бұрын
why did u use return in the getRandomFromPalette? i don't understand this
@derink85233 жыл бұрын
Hello @Julianna Lemos, this is so that the function outputs ("returns") a random color wherever it is used. So on line 26 where they call getRandomFromPalette(), the computer calls the getRandomFromPalette function, which then returns a random color from the PALETTE constant that prints out where it is used. sidenote: constants are declared in ALLCAPS by convention, you could use normal case, they are like a variable, you just use them when you don't expect them to change throughout your program. None of this is mandatory in javascript, it's just good practice as it makes code clearer to read.