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 trialAngelica Islas
4,082 PointsWhy is this wrong?
const data = ['100',
'80',
'60'
];
A related question: How do you decide whether you will use var, let or const when naming an array?
2 Answers
Unsubscribed User
Front End Web Development Techdegree Student 33,900 PointsAbout your question about var, let and const when naming an array:
1) If you do not have to reassign the array -> use const! (and in most cases you do not have to reassign, you just use methods to change the content of the array)
2) If for some reason you have to reassign an array then you would use let! (i am absolutely sure there are cases when you may want to do so, but i actually could not come up with an example)
So, in most cases you will use const for arrays.
Unsubscribed User
Front End Web Development Techdegree Student 33,900 PointsAbout your original question:
You stored strings inside of your arrays, not numbers (as asked in the task)... ;-)
Take away the '
at the beginning and end of each number and you will pass.
Blessings from Berlin and happy java-scripting, Nils
PS: If my answer helped you or solved your issues, please upvote my answer and/or mark it as "Best answer" (so people browsing the community forum know your issue is solved)
Sean Fallon
8,516 PointsSean Fallon
8,516 PointsFrom what I can tell it is not wrong. When I call the array positions it works fine.