+ 1
JavaScript Overview
Can someone help me with 5.2 practice Escape? How do you get rid of the single quote? console.log('I'm learning JavaScript'); console.log("A quote: "Java is to JavaScript as ham is to hamster." ");
6 Antworten
+ 7
you need to add a \ before the ‘ in the sentence.
Like
console.log('I\'m learning JavaScript');
+ 3
or enclose your string in double quote to avoid escaping single one, and reciprocally:
console.log("I'm learning JavaScript");
console.log('A quote: "Java is to JavaScript as ham is to hamster."');
+ 1
console.log('I\'m learning JavaScript');
console.log("A quote: \"Java is to JavaScript as ham is to hamster.\" ");
+ 1
add this character '\' (backslash) like this :
console.log('\"Im learning JavaScript\"');
so this means the \ character will escape the quotes✌
0
This is correct Answer.
console.log('I\'m learning JavaScript');
console.log("A quote: \"Java is to JavaScript as ham is to hamster.\" ");
0
console.log("I'm learning JavaScript");
console.log('A quote: "Java is to JavaScript as ham is to hamster."');