+ 1
hmm, js quotation marks problem _?
Ok so, so far I know of these quotation marks `` , '' , "" Those three. And I've used all of them in my code. 'cod.js..lbleblahblah'; var x = "a" u.innerHTML = `<h2> wow </h2>` Now, I want to turn the code into a string. But, it's not gonna work, cuz that' just how it is and it will read the code as ... some as variables... and it would just be mixed up. It just doesn't work that way. I guess You could try it, but ..ye I was wondering if there was a 4th quotation mark, or a work around this. ?
4 Answers
+ 2
You can use the backticks (``) but also have to escape the inner-backticks like so:
var str = `function(){
var x = ândjdâ
var y = âhdâ
var d = \`ndksksm\`
}`
+ 2
you can use replace() method in js
let html = "<span>i am html</span>
let rep = html.replace(/</g, â<")
with replace method you can replace < with its html entity character , which will be printed on page but not get rendered
https://code.sololearn.com/Wo2UC3lH72QS/?ref=app
+ 2
Or just write how you want it between the quotes.
There are several of these character code that can be used to display various types of characters in your strings.
u.innerHTML = "<h2> wow </h2>"
https://www.rapidtables.com/web/html/html-codes.html
https://www.w3schools.com/html/html_symbols.asp
+ 1
ChaoticDawg im not talking about special characters. im talking about specifically quotation marks:
ââ, ââ, ``etc.
I used all of them in my code, now i want to make the code a string but cant.
function(){
var x = ândjdâ
var y = âhdâ
var d = `ndksksm`
}
now i want to make the above code a string..
var string = âfunction...
..}â