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 trialSeyoung Kwak
9,091 PointsarrayCounter passes 'number'
Task: Create a function named 'arrayCounter' that takes in a parameter which is an array. The function must return the length of an array passed in or 0 if a 'string', 'number' or 'undefined' value is passed in."
When I check my code, it says "Bummer! If I pass in an array in to 'arrayCounter' of '1,2,3' I get 0 and not the number 3."
Question : When the task asking to return 0 if 'number' passed in. Isn't 1,2,3 ('number') should return 0 when it passed?
1 Answer
Andrew Shook
31,709 PointsThis question has been asked multiple times here on the forum. You can find several answers and there explanations here.