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 JavaScript Foundations Functions Return Values

Challenge Task for Return Values

Help me out with process in Treehouse - when I get stuck, like I currently am, I don't see where I can get advice, or hints ... I'm just left flat out stuck. I don't get what I should do, so I end up halting entirely instead of getting assistance to get over something I initially don't get. Am I missing something in Treehouse for learners that would address this gap? Thanks!

6 Answers

Chase Lester
Chase Lester
10,972 Points

Jason Ziegler -- try putting in the argument "array" instead of "x". function arrayCounter(array) then replace x with array. You can also try this code below:

function arrayCounter (array) {
    if (typeof array === 'undefined' || typeof array === 'string' || typeof array === 'number') {
        return 0; 
    }
    return array.length;
}
Chase Lester
Chase Lester
10,972 Points

The forums are you best help. People usually answer pretty quick. Also another thing is, a lot of the challenge questions have already been asked by someone, so just copy the question you are stuck on, and paste into google and more than likely you will find that its been asked and you can see the answer

Chase, that helps. Thanks.

Jason Ziegler
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jason Ziegler
Full Stack JavaScript Techdegree Graduate 39,583 Points

I am having trouble with this challenge, also.

here is what I have so far:

function arrayCounter(x) { if (typeof x === 'undefined') { return 0; } if (typeof x === 'string') { return 0; } if (typeof x === 'number') { return 0; } if (typeof x === 'array') { return x.length; } }