Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
84
rated 0 times [  86] [ 2]  / answers: 1 / hits: 59738  / 15 Years ago, wed, june 3, 2009, 12:00:00

I saw this question and I am wondering about the same thing in JavaScript.



If you use the character ' or the character when making strings in JavaScript, the application seems to behave the same. So what is the difference between these two characters?



The only advantage I have seen in using ' to build strings is that I can do stuff like:



var toAppend = '<div id=myDiv1></div>';


Instead of:



var toAppend = <div id=myDiv1></div>;


Is there any significant difference between them that I should be aware of?


More From » string

 Answers
5

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.


[#99403] Thursday, May 28, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aleighabayleef

Total Points: 511
Total Questions: 99
Total Answers: 99

Location: Aruba
Member since Fri, Jun 24, 2022
2 Years ago
aleighabayleef questions
Fri, Jun 5, 20, 00:00, 4 Years ago
Thu, Jun 4, 20, 00:00, 4 Years ago
Sat, Sep 21, 19, 00:00, 5 Years ago
Thu, Jul 18, 19, 00:00, 5 Years ago
;