JScript small doubt

In JScript, is there any significant difference in between ‘a’ and “a” ?

Not really. Just make sure that you are ending with the same marks you started with.

They are equivalent for all intents and purposes. If you want to use either one inside a string, it is a good idea to use the other one to create the string, as you noted. Other than that, it’s all the same.

There’s no functional difference between ' and " when used as string delimiters. ' seems to be slightly more commonly used, and is slightly preferable on the grounds that it’s one less key stroke (no Shift). Whichever one you choose, it’s best to stay consistent to keep your code tidy.

Note that “JScript” refers specifically to Internet Explorer’s implementation of ECMAScript. JavaScript (shortened to “JS”) is another implementation, though people often use “ECMAScript” and “JavaScript” somewhat interchangeably.

2 Likes

I like to use single apostrophe in code, except for when the string literal itself contains an apostrophe (easier to read without the escape backslash!)

In JSON data files, the double quote is required for properly formatted json… e.g.
{‘key’:‘value’} is not valid json… it should be: {“key”:“value”}

Sticking to single quote in code, double quote in data can act as kind of a mental cue to differentiate the two.

I got it. Thanks all for your response. It’s helpful :slight_smile: