I am still confused pertaining to the use of backslach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I am still confused pertaining to the use of backslach

19th Dec 2016, 5:05 PM
mohd adeeb
mohd adeeb - avatar
2 Answers
+ 3
Escape-Sequence character (search it on Google)
19th Dec 2016, 5:39 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
The backslash is used to tell the compiler/interpreter "Hey, this next character is to be treated differently!". For example, if you want to store the string, "My favorite movie is 'Raising Arizona', by the Cohen brothers." as a variable, you would run into problems using the quotes around the title, Raising Arizona. To let the compiler/interpreter know that you want the quotes to be part of the string, and not the end of the variable, you use the backslash. The result would look like this: var movie = 'My favorite movie is \'Raising Arizona\', by the Cohen brothers.'; Also, there are special uses of certain letters to request non-printable characters. Using "\n" says, "Make a new line". Using "\t" says, "Insert a tab character", etc.
4th Feb 2017, 8:39 PM
Troy McGuire
Troy McGuire - avatar