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!

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


Challenge Problem


I'm having some difficulties with this javascript challenge:


This is my code so far:

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

        return array.length;

Could please anyone give me the solution for this challenge. I really don't understate where am I making a mistake.



3 Answers

don't bother I have just solved it by myself...

could you please share the correct code? I am stuck on the same challenge currently and have a very similar code to the one you posted originally.

Sorry but I'm on pre-Christmas vacation and be back on Monday so until then I'm unable to help you.

Bye, Andrej

No worries, thanks for responding. Actually we just resolved the issue here: https://teamtreehouse.com/forum/help-with-return-values-challenge