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.
How to create an Array?
Create an array named data and store any 3 numbers in it.
I created an array and stored 3 numbers inside. I checked my work and got this message; Bummer! There was an error with your code. Syntax error; parse error.
What am I doing wrong?
var data = [ '7' '15' '26' ];
Jennifer NordellTreehouse Teacher
Close! Really close... but not quite. First, the elements in your array need to be separated by commas. But secondly and most importantly... those aren't numbers. I know... I know... they look like numbers, but because they are in quotes they're now strings. They are the kind of numbers we might use in a street address, telephone number, or social security number. It's nothing we would ever do any mathematical operations on. I've reformatted your array so it works. Take a look:
var data = [7, 15, 26];