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

Connor Hamilton
Connor Hamilton
5,023 Points

Brackets and Braces.

Is there a simple way of understand what brackets and braces are used in regards to which functions/methods/objects they belong to?

When coding myself i am not placing them or using the incorrect ones and its messing my syntax let alone throwing errors everywhere.

With Arrays thrown in as well there's a lot of times to use them in different situations. ( { [

Ive just completed the introduction to Javascript and programming courses in the Front end course but this is really slowing me down.

1 Answer

Sreng Hong
Sreng Hong
15,083 Points

Hi Connor

For me, I think after you write a lot of codes you will remember it by yourself.

Don't be so stressed, just keep practice day by day and you'll archive it.

Hope it helps.

Sreng Hong
Sreng Hong
15,083 Points

Here are some examples:

  • function needs parentheses: function()
  • array needs brackets: arrayName = []
  • a block of code needs braces {} (also use to create object)