+ 1
How can I put a variable value inside a string.
var red = 24; var green = 87; var blue = 50; document.getElementById ("para").style.background = "rgb(red green blue)"; How I put those variable values inside string to apply the background colour.
3 Answers
+ 1
with the + sign. it can concat two strings or other types by converting them automatically to string.
... = "rgba(" + red + ", " + green + ", " + blue + ", 1.0)";
+ 1
Thank you for your help.
0
n : m l