Escaping Characters in Strings | Sololearn: Learn to code for FREE!

-2

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

11/29/2021 10:54:58 AM

A.K.-GAMERZ __YT

19 Answers

New Answer

+4

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.

+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.

+3

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.

+2

You havent provided the code, also the "hint" is the answer

+2

It literally say: "Fix the given code..." you have to provide the code. Only you can see it. What about the hint is confusing???

+1

So it's hard for me to understand

+1

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?

+1

Plese help me this cod

+1

Zaki Love Please create a new question

0

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');

0

Can u give me some more Hints

0

Or give one example to make me understand

0

Pls I am just a child of 8th class

0

O thanks pro

-1

Because I wasn't provided by code and hint is confusing

-1

Hint is use backslash to escape the single quote

-1

Your code is : console. log('I'm learning javascript') l;

-3

console.log("I\'m learning Javascript") should work