+ 1
Strings ( Java Script)
Strings (JS) has to be inside quotes thus quotes within stings has to be inside backslashes for the string to print ?
4 Réponses
+ 5
In JavaScript you can use ' or " for strings. You don't need to escape these characters if you use the other one to declare the string:
'hi "Petra", how are you'
"hi 'Petra', how are you"
Of course you have to escape if you have to use the same character:
'hi \'Petra\', how are you'
"hi \"Petra\", how are you"
+ 4
Petra, your second sentence in JS should be:
'\'or " seems practical'
just for practice
+ 3
Not "inside" backslashes, but PRECEDED BY one backslash... as for saying "hey, this quote is not the signal of the end of the string, it's inside it" to the parser ;)
+ 1
'hi\'Tamas\'thank you!'
'or " 'seems practical'