Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the type of quotes matter when using use strict?

Tags:

I was wondering since I'm trying to use use strict, does it matter if I go with "use strict" or 'use strict'?

Is any of those a «more correct» option?

like image 468
Zentaurus Avatar asked Dec 30 '13 14:12

Zentaurus


1 Answers

Actually in Javascript using double quotes or single quotes doesn't change anything.

It's more important you use the same option in your entire code.

Even if you use mixed quotes it will not change anything:

'use strict' var myString = "double quotes string" 

So using use strict with double quotes or single quotes are the same.

In many libraries they commonly use one of them for strings and another to avoid escape, like in this example:

'A string that\'s single quoted'  "a string that's double quoted" 

So specifically in English sometimes is useful using double quotes instead of single quotes to avoid this kind of escape thing.

like image 85
Vitor Canova Avatar answered Sep 21 '22 11:09

Vitor Canova