Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Javascript course level 6 lesson 5 (escape all special character)need solution

let x = 'I love 'Chocolate'\'Butterscotch' ice cream.';

// log the variable
console.log();
by

5 Answers

aashaykumar
hello, can you enter the code here that you are trying to enter ?
Ashutosh3fk7u
let x = 'I love \'Chocolate\'\'Butterscotch\' ice cream.';

// log the variable
console.log(x);

output:->
I love 'Chocolate''Butterscotch' ice cream.


But after clicking on submit.It shows
You missed to escape some special character.
please check again.
SaravananRajendran
Ans: the expected output should be string with single slash , so tried by adding another escape character \ to print the string with single \ and I tried without that escape character but still .It shows You missed to escape some special character.
please check again.

please some one help me out this
abhi325
solution:
let x = 'I love \'Chocolate\'\\\'Butterscotch\' ice cream.';

// log the variable
console.log(x);
abhi325
Solution:
let x = 'I love \'Chocolate\'\\\'Butterscotch\' ice cream.';

// log the variable
console.log(x);

Login / Signup to Answer the Question.