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

Manish Bhattarai
Manish Bhattarai
3,897 Points

eRROR

IT KEEPS SAYING "yOURE MISSING THE FUNCTiON 'arrayCounter" wheb i clearly have that function.here is the script...

function arrayCounter(a) { if (a==="string") or (a==="number") or (a==="undefined") { return 0;}

       return a.length;
  }
  myarray=array[];
  arrayCounter(myarray);

Please include your script. :) Thank you.

Dave McFarland
Dave McFarland
Treehouse Teacher

You can get an error like that, if there's a syntax error in you function declaration -- for example missing the closing } character at the end of the declaration:

function myFunction() {
   alert("This won't work! I forgot the closing }");

In this case because the } is missing the function is never declared -- it doesn't exist and "is missing".

1 Answer

Manish Bhattarai
Manish Bhattarai
3,897 Points

function arrayCounter(a) { if (a==="string") or (a==="number") or (a==="undefined") { return 0;}

       return a.length;
  }
  myarray=array[];
  arrayCounter(myarray);