Q) I want to know about difference between ' and "


#1

is there any difference...?


#2

In technical terms.. No.

However, if you wanted to use (") in your sentence then you would surround the string with (') instead. and vice versa. It allows you to utilize those characters without ending your sentence prematurely. Otherwise I haven't found any other difference.


#3

like ' "content" ' and " 'content' " ?


#4

Right,

Either way it'll send the string, but this way you can incorporate them into your string. It gets tricky if you would like to have both in the string at once, but you can just swap the ' " ', and " ' " with a + sign between them. like the following

prompt(' "This is what the fox said" ' + "It's not what he actually said");


#5

How kind of you! thank you!


#6

In case you want both of them in a sentence you could escape them by \ e.g.

console.log("The word \"Test\" is written in \'\' oh wait no it's \"\" ");

#7

That's probably the easiest way, but I was showing him how he could use the difference between a ' and a ". If there's any other reason to use one or the other I haven't run into it.


#8

Me neither (at least not for javaScript) and what you said was fine just wanted to mention this way as well.