Wrote a little bit of test code
Test Results:var str = ' This is Jack '; var str2 = "This is Tom"; var str3 = ' This is ' Rose '; var STR4 = "This is ' LiLi '"; var STR5 = "This is \" "Sun\"; var STR6 = ' This is \ ' mary\ '; var STR7 = "This is \ ' lucy\ '"; var str8 = ' This is \ ' rooney\ '; var STR9 = ' This is \\Ronaldo\\ '; Console.log (str); Console.log (STR2); Console.log (STR3); Console.log (STR4); Console.log (STR5); Console.log (STR6); Console.log (STR7); Console.log (STR8); Console.log (STR9);
This is Jack
This is Tom
This is "Rose"
This is ' LiLi '
This is "Sun"
This is ' Mary '
This is ' Lucy '
This is "Rooney"
This is \ronaldo\
(1) Use only character strings, single and double quotes without distinction
(2) You can use double quotes directly in a string enclosed in single quotes, and you can use single quotes directly in a string enclosed in double quotes
(3) If double quotes are used in double quotes, you need to escape with a backslash, note "\", and a single quote in the string enclosed in single quotes, and you also need to escape
(4) If you want to use a backslash, enter ' \ \ '