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

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.