- 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
22 Respuestas
+ 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.
+ 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
You havent provided the code, also the "hint" is the answer
+ 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.
+ 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?
+ 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???
+ 1
So it's hard for me to understand
+ 1
Plese help me this cod
+ 1
Zaki Love Please create a new question
0
Because I wasn't provided by code and hint is confusing
0
Wait
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
0
//fix the code
console.log("I'm learning JavaScript");
Good Luck
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.
0
print('I\'m a programmer')
try it
- 1
Your code is :
console. log('I'm learning javascript') l;