I am trying to declare <div class="div-name">1</div>
as a string. I am having difficulty due to the double quotes.
I am tried wrapping the string around single quotes ('<div className="div-name">1</div>'
), but instead the result is "<div className="right-align">100</div>"
Is there another solution to this?
3
Answers
Please update with more data
In any case you can always try opening the browser console and creating a variable and the console log you can see the result
For example
or
Template Literals
Use Template Literals:
Wrap the string into backticks as
By using template literals you can also use variables in it as follow:
Learn More About Template Literals from here : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals