Build a Random Quote Machine - Syntax help

Tell us what’s happening:

Hello! I am able to generate my random hex color and have my document.getElementById working but am unable to properly pass my hexColor variable through.

for example, if I replace {hexColor} with green the background renders green.

Can you help me understand my error so I can move forward? Thanks!


Your code so far

var hexColor = ‘#’+(Math.random()*0xFFFFFF<<0).toString(16);

document.getElementById(‘quote-box’).style = background-color: {hexColor};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36.

Link to the challenge:

Add a $ to the string interpolation thing. As in
document.getElementById(‘quote-box’).style = background-color: ${hexColor} ;

1 Like

Of course! Thank you.