Question: Why does this code trigger an error?
- Strings should always be wrapped in double quotes; and double quotes inside a string should be escaped by backslashes.
- All single and double quotes inside a string need to be escaped by backslashes to prevent a parse error.
- The opening and closing single quotes should be replaced by double quotes; and the apostrophe should be escaped by a backslash.
- The apostrophe needs to be escaped by a backslash to prevent it from being treated as the closing quote.
Answer: The correct answer of the above question is Option D:The apostrophe needs to be escaped by a backslash to prevent it from being treated as the closing quote.