0

This is probably a very simple thing to do but I am having trouble using variables in my strings although following usual protocol.

Here is my code:

 else if (weatherDesc.includes(desc)) {
        message.innerHTML = 'Look out for ${desc}';
    }


not really sure why this is not working, I tried switching from single quotes to double.

ryan
  • 59
  • 8

2 Answers2

3

You should use Template literals (Template strings) by wrapping text in backtick and not single quote like you did

message.innerHTML = `Look out for ${desc}`;
Yves Kipondo
  • 4,832
  • 1
  • 17
  • 26
2

You should use backtick character:

message.innerHTML = `Look out for ${desc}`;
Mikhail
  • 9,889
  • 7
  • 26
  • 50