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.


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