You can use quotes inside a string, as long as they don't match the quotes surrounding the string. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

You can use quotes inside a string, as long as they don't match the quotes surrounding the string.

can anyone explain the above statement????

27th Dec 2017, 5:19 PM
Abu Ubada
Abu Ubada - avatar
1 Answer
+ 7
It means that you can use single quotes inside a string but not double quotes (a string is surrounded with double quotes). 1. "My name is 'abd' " - correct 2. "My name is "abd" " - wrong For no. 2, you can use the escape character called backslash instead: "My name is \"abd\" " P.S. From next time, please specify the language with your question. (This is from the JS course.)
27th Dec 2017, 5:27 PM
Dev
Dev - avatar