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

Daniel smith
Daniel smith
1,248 Points

Code not working in brackets

ok so I copied all the working code from the workspace on treehouse into brackets and none of the js is working. what is going on?

2 Answers

Since you mentioned brackets, I'm assuming you're creating an array. Double check that the array is formatted properly: start by naming the array like you would a variable; make sure that any strings inside your array are enclosed in matching quotes (single or double) and that multiple values are separated by commas (don't put a comma after the last value); don't forget the semicolon after the closing bracket. Here's an example array that contains a string, a number, and a Boolean value:

var arrayName = [ 'string of words', 23, true ];

If that doesn't answer your question, perhaps you could copy the code into the comments. That way we can see what you're seeing and it will be easier to answer your question. :)

Oh okay, thanks Omar. I saw the question posted in the JavaScript section and didn't make the connection to a separate program.