1/*
2 You can use either.
3 Double quotes are the only allowed character for
4 strings in JSON, and HTML conventions suggest using it.
5 However, single quotes are far more popular in JS and CSS.
6 Most JS learning programs use the single quote, but most development
7 environments mainly link to or even have all of their templates in
8 double quotes, as well. Although I've learned JS with
9 single quotes and it seems archaic in some places, I discourage,
10 denounce, and despise not using single quotes in programs
11 that don't have all of their templates mostly in double
12 quotes. They've become a popular choice, although not widespread.
13 Also, if you have access to ES6, you can also use a backtick.
14 Although it is scarcely used other than using it for its actual
15 purpose, which is a template literal, it'll also save you from
16 typing some backslashes, and it only requires a tiny bit
17 of practice to type easily.
18*/
19// Example 1
20'Please don\'t try this at home. We\'re professionally trained to do this.'
21"Please don't try this at home. We're professionally trained to do this."
22`Please don't try this at home. We're professionally trained to do this.`
23// Example 2
24'"To live is to struggle. To survive is to find meaning in the struggle."'
25"\"To live is to struggle. To survive is to find meaning in the struggle.\""
26`"To live is to struggle. To survive is to find meaning in the struggle."`
27// Example 3
28'`const meaningOfLife = 42;`'
29"`const meaningOfLife = 42;`"
30`\`const meaningOfLife = 42;\``
31// Example 4
32'"We\'re no strangers to love."'
33"\"We're no strangers to love.\""
34`"We're no strangers to love."`
35// Example 5
36'`console.log("Hello World!");`'
37"`console.log(\"Hello World!\");`"
38`\`console.log("Hello World!");\``
39// Example 6
40'`console.log(\'Hello World!\');`'
41"`console.log('Hello World!');`"
42`\`console.log('Hello World!');\``
43// Example 7
44'Which? `console.log("Hello World!");`\n`console.log(\'Hello World!\');`'
45"Which? `console.log(\"Hello World!\");`\n`console.log('Hello World!');`"
46`Which? \`console.log("Hello World!");\`\n\`console.log('Hello World!');\``
47/*
48 Here's the amount of examples which required escape characters:
49 Single quote: 1, 4, 6, 7 (4).
50 Double quote: 2, 4, 5, 7 (4).
51 Backtick: 3, 5, 6, 7 (4).
52 They're all even. Go and look back at the examples, and pick the
53 character that won't require escape characters in your most common
54 use cases.
55*/
56/*
57 The conclusion? I'm tending toward backticks right now.
58 Of course, I'm still not undecided about using single quotes
59 around mostly, but, practically, you'd wanna use backticks.
60*/