Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

827 B

title
title
Escaping Literal Quotes in Strings

Escaping Literal Quotes in Strings


Hints

Hint 1

  • When you need to use a special character such as " inside a string you need to escape it using \.
  • If you use double quotes " for the string, single quotes ' in the string do not need to be escaped.
  • If you use single quotes ' for the string, double quotes " in the string do not need to be escaped.

Solutions

Solution 1 (Click to Show/Hide)
var myStr = 'I am a "double quoted" string inside "double quotes".';
var otherStr = "I am a 'single quoted' string inside 'single quotes'.";
var noEscapeSingle = "There is no need to 'escape' the single quotes.";
var noEscapeDouble = 'There is no need to "escape" the double quotes.';