+ 2
6th Aug 2021, 6:47 AM
ln e
8 odpowiedzi
+ 4
You can use either concatenation or template literals to solve your problem. concatenation - "rgb("+x+","+y+","+z+")" template literals - `rgb(${x},${y},${y})`
6th Aug 2021, 9:50 AM
ODLNT
ODLNT - avatar
+ 5
You have created the main var outside the function. Try making that inside the function. And use the var keyword and not let keyword.
6th Aug 2021, 6:51 AM
Parth
Parth - avatar
6th Aug 2021, 8:59 AM
Anas Dharar
Anas Dharar - avatar
+ 2
ln e it won't work because you are giving the background colour as a string
6th Aug 2021, 7:03 AM
Eashan Morajkar
Eashan Morajkar - avatar
+ 2
And not the actual numbers
6th Aug 2021, 7:03 AM
Eashan Morajkar
Eashan Morajkar - avatar
+ 2
Thanks a lot for your answers.
6th Aug 2021, 10:09 AM
ln e
+ 1
It's still not working.
6th Aug 2021, 7:00 AM
ln e
+ 1
So how to fix it if I need a bg color varying randomly with each click ??
6th Aug 2021, 7:51 AM
ln e