You would mostly use " unless in a position in where you can't escape it. ( It is neater to most developers, Don't ask why )
Also "$myVar"
in php will allow the string to have the variables value. ( I know its not javascript, but another example..
In bash,
echo "What is your name?\nMy name is $(whoami)."
will run the function / command whoami.
<button onclick="dosomething(\"test\")">Test</button> Won't work
<button onclick="dosomething("test")">Test</button> Won't work
<section id='"Where-As">
<button onclick="dosomething('test')">Test</button>
<!-- will work -->
</section>
P.S: Valid JSON objects should be using double quotes.
Other fun with different quotes:
console.log('\n\n\n\n'); // Will give you \n\n\n\n as a string.
console.log("\n\n\n\n"); // Will give lines.