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
  • 69
  • 1
  • 9

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
  • 5,289
  • 1
  • 18
  • 31
2

You should use backtick character:

message.innerHTML = `Look out for ${desc}`;
Mikhail
  • 11,067
  • 7
  • 28
  • 53