Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Working With Numbers The Mad Libs Challenge Revisited

3 Answers

in JavaScript [] is used to define elements in an Array,

ex.

var myArray=["Book", "Car", 54, 143];

Here are the videos that cover this topic https://teamtreehouse.com/library/javascript-loops-arrays-and-objects

jack pincombe
jack pincombe
6,188 Points

I think in this case the [] are just there for visual purposes [so that the text is shown like this]

since they are using ' ' on either bracket

jason chan
jason chan
31,009 Points

No an array is to store functions, integers, object laterals and variables.

You have to have access through things some how and an array is different way to store a lot of different data types.

Hi Jason I am not sure what you are referring to here but the initial question was what are the brackets used for.