why this gives 's as output? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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