- 2

Please I need help on using the js excape character

Except character \

24th Nov 2021, 2:52 PM
Enoch Chigozie
7 odpowiedzi
+ 4
You need to escape the ' in I'm to make it work: put the \ before '
24th Nov 2021, 4:00 PM
Lisa
Lisa - avatar
+ 2
Can you give an example how you want to use it? You only need to write it in front of the to-be-escaped character: console.log(" \" ");
24th Nov 2021, 2:55 PM
Lisa
Lisa - avatar
+ 2
You can use single quotes as well, that doesn't matter
24th Nov 2021, 3:53 PM
Lisa
Lisa - avatar
0
Thanks for responding Using single quote
24th Nov 2021, 3:32 PM
Enoch Chigozie
0
Something like this is given console. log('I'm a javascript programmer') Then I am ask to escape with backslash (\) And the expected result is, I'm a javascript programmer I HAVE TRIED DIFFERENT METHODS AND IS NOT WORKING. PLEASE HELP
24th Nov 2021, 3:58 PM
Enoch Chigozie
0
You write the escape sequence just before the charcacter that you want to escape. For example... \' would be read as simply ' by the compiler. So you should write console.log('I\'m a javascript programmer');
25th Nov 2021, 8:36 AM
Anuj Kumar Patel
Anuj Kumar Patel - avatar
0
Or you could also use combination of quotes... console.log("I'm a javascript programmer"); Then there is no problem.🙂
25th Nov 2021, 8:38 AM
Anuj Kumar Patel
Anuj Kumar Patel - avatar