DEV Community

Discussion on: JS: How to implement a Random Background Color Change to make your sites more professional

klajdi44 profile image
Klajdi Ajdini

Nice, I would take a more modern approach to this and use const/let instead of var and use template literals instead of concatenating the values with +.

const  bgColor =  `rgb( ${x}, ${y}, ${z} )`;
Enter fullscreen mode Exit fullscreen mode
devlorenzo profile image
DevLorenzo Author

Yes, you're right. The only problem is that I have an Italian keyboard and backtick are difficult to use. But we should always use it.