Complementing what my colleagues have commented on that there are no differences between double and single quotes, I explain the following:
It is recommended to use one of the two types of quotes and be
recurrent in your code with it. If possible, do not use both
mixed types in javascript.
Why? because generally you will not use javascript as the only language even in cases like combining angularjs + nodejs requires a third factor like HTML.
So if you need to embed javascript in another language (like PHP
for example) or vice versa will be very difficult:
Detect what a comment is and what it is not. Quickly observe the
variables in the code in order to debug it Determine where the term ends
code of one language to start the other
In short, code maintenance will be complex, the code will be a bit illegible and also likely to generate more errors when executing it.
For example, I use the single quotes as much as possible for javascript and so I leave the doubles for HTML and PHP, so when I embed javascript in my HTML or PHP it is more practical and simple.
A didactic example is the following:
<?php echo "<script>alert('Hola')</script>"; ?>
How would you do to execute the previous statement if you both put them in double quotes? It would be a bit complicated.
Another example:
var input = '<input type="text" name="prueba" id="prueba" >';
Notes how easy it is to embed HTML in javascript respecting the use of single and double quotes for each of them?
Observation: There are some cases where using javascript with double quotes is more feasible than using it with single quotes. The important thing is to try not to mix both for the same language as mentioned above.