+ 1

why this gives 's as output?

var str = '\' ' +'s' console.log(str) //output is 's

2nd Aug 2019, 1:29 PM
Danielov
Danielov - avatar
1 Réponse
+ 3
You might ask why \ was not in output? It's because \ is a special character used to escape some characters, when \ escapes any character, it will not be printed. If you want to print \, you need to escape it's self by another blackslash, \\
2nd Aug 2019, 1:48 PM
Seb TheS
Seb TheS - avatar