Strings and using quotes

Joined
Dec 5, 2022
Messages
1
Reaction score
0
so when we have a string we ave to use double or single quotes and cant mismatch them but what happens if i want say something like
a string that has a quote inside of it like 'he said "this"', this works but what if a need an to use a single quote inside of the quote itself like
'he said "sam's club" ' how do i solve this
 
Joined
Mar 11, 2022
Messages
227
Reaction score
32
Escape it:
Code:
console.log('My brother\'s car');
//or without mismatch
console.log("My brother's car");
//or
console.log("My so called 'brother' is my stepbrother");
//or
console.log('My so called \'brother\' is my stepbrother');
//or
console.log("My so called \"brother\" is my stepbrother");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top