In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\
) in front of the quote.
var sampleStr = "Alan said, \"Peter is learning JavaScript\".";
\' | single quote |
\" | double quote |
\\ | backslash |
\n | newline |
\r | carriage return |
\t | tab |
\b | backspace |
\f | form feed |
Use Bracket Notation to Find the First Character in a String