0

Working in JavaScript whenever I use ${myVariable} in a string it will print ${myVariable} instead of the value of the variable. Please help I have no idea how this is wrong Ex: console.log(‘${raceNumber} will race at 9:30 am’) Will print $raceNumber will race at 9:30 am. Instead of the value I have assigned to that variable

  • You didn't even include a ternary operator in your question. The question you ask isn't even properly punctuated with a ternary operator. Besides that, the templating doesn't work because template literals must be encased with `\``, not `'`. – code Oct 22 '22 at 18:43

0 Answers0