Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Double quotes can be added to strings within an array by using the escape character "\" before the double quote.

For example:

let myArray = ["Hello", "World", "John said \"Hi there!\""]

In this example, the third element in the array contains double quotes within the string. By using the "\" character before the double quotes, they are treated as part of the string rather than ending the string prematurely.