- 5

Escaping Characters in Strings

Fix the given code to output the following expression: I'm learning JavaScript Hint Escape the single quote inside the string. Use backslash for escaping

29th Nov 2021, 10:54 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
22 Answers
+ 6
Right, \ <-- That's a backslash ' <-- That's a single quote use a backslash to escape a single quote on the code you still have not posted.
29th Nov 2021, 11:04 AM
Slick
Slick - avatar
+ 4
I can't, this one's so simple if I told you anything else I might as well just do it for you. I also literally just gave several examples in the last post.
29th Nov 2021, 11:13 AM
Slick
Slick - avatar
+ 3
You havent provided the code, also the "hint" is the answer
29th Nov 2021, 10:58 AM
Slick
Slick - avatar
+ 2
Ecapable characters act different when a backslash is placed before them with no space. Quotes are considered strings and don't close previous quotes, \n is a newline character, \t is tab character, and theres more. Can you see how the hint is the full on answer? Do what the hint says.
29th Nov 2021, 11:09 AM
Slick
Slick - avatar
+ 2
Your code here is: console.log('I'm learning Javascript') If you try the code above,you will get a fatal error. That's because Javascript parses 'I'm learning Javascript' into ['I']m learning Javascript[' instead of ['I'm learning Javascript'] The quotation mark (') on "I'm" was interpretated as a string literal ending, instead of a character in a string. To avoid this, you can put a backslash (\\) to escape that character from actual code Example: //Put a backslash next to the quotation mark on "Isn't" console.log('Isn\'t it obvious?') Output: Isn't it obvious?
29th Nov 2021, 12:49 PM
Boay.JS
Boay.JS - avatar
+ 1
It literally say: "Fix the given code..." you have to provide the code. Only you can see it. What about the hint is confusing???
29th Nov 2021, 11:01 AM
Slick
Slick - avatar
+ 1
So it's hard for me to understand
29th Nov 2021, 11:14 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
+ 1
Plese help me this cod
2nd Dec 2021, 3:07 AM
Zaki Love
Zaki Love - avatar
+ 1
Zaki Love Please create a new question
2nd Dec 2021, 3:25 AM
Boay.JS
Boay.JS - avatar
0
Because I wasn't provided by code and hint is confusing
29th Nov 2021, 10:59 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
0
Wait
29th Nov 2021, 11:04 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
0
Escaping Characters in StringsFix the given code to output the following expression: I'm learning JavaScript Hint Escape the single quote inside the string.Use backslash \ for escaping.//fix the code console.log('I'm learning JavaScript');
29th Nov 2021, 11:05 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
0
Can u give me some more Hints
29th Nov 2021, 11:11 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
0
Or give one example to make me understand
29th Nov 2021, 11:12 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
0
Pls I am just a child of 8th class
29th Nov 2021, 11:14 AM
A.K.-GAMERZ __YT
A.K.-GAMERZ __YT - avatar
0
O thanks pro
2nd Dec 2021, 10:55 AM
Zaki Love
Zaki Love - avatar
0
//fix the code console.log("I'm learning JavaScript"); Good Luck
25th Jan 2022, 2:53 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
0
hey guys ...i need an help here Strings Fix the given code to output I'm a programmer. Hint Escape the single quote inside the string.
25th May 2022, 12:20 PM
Burundi Mushe
0
print('I\'m a programmer') try it
26th Sep 2022, 6:08 PM
Pusparasa Ayilavan
Pusparasa Ayilavan - avatar
- 1
Your code is : console. log('I'm learning javascript') l;
30th Nov 2021, 10:20 AM
Shubham Bhatia
Shubham Bhatia - avatar