Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Adding Data to Arrays

Does using double quote in array matter or is it the same as single quote? I am just curious.

I just want to know if single or double quote matter when dealing with array. For example, var Names = ["John", "David", "Joe", "Moses"]; or I should stay with single quote like this var Names = ['John', 'David', 'Joe', 'Moses']; Thanks you and wonderful video.

2 Answers

Samuel Webb
Samuel Webb
25,369 Points

They work the same in this situation. Use whichever one you like the most.

Sometimes you'll want to use one over the other. If you were quoting someone and wanted those quote marks to be a part of the string, it would be simpler to just use single quotes around the whole thing so you don't have to escape characters.

ok, thank you very much.

Samuel Webb
Samuel Webb
25,369 Points

No problem. Glad to help.