In JS you have two ways to define a string:
'' single quotes
"" double quotes.
let s1 = 'I am a valid string';
let s2 = "I am a valid sting too"
Notie that you cannot mix them If you start with a
single quote, it has to finish with a single quote as well, otherwise the JS interpreter cannot understand that the string is terminated:
let s = 'I end with a double"
// SyntaxError: Unterminated string constant
That said, if you want to use a the same quote inside the string as punctuation, you need to escape it, otherwise the JS interpreter don’t have a way to tell it’s punctuation opposed to end of the string
let z = 'It's a miracle'
// SyntaxError: Unexpected token
This happens because JS thinks the string ends at
it's... (a single quote)
Same for double quotes.
Hope this helps