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 trialManish Bhattarai
3,897 PointseRROR
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);
Dave McFarland
Treehouse TeacherYou 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
3,897 Pointsfunction arrayCounter(a) { if (a==="string") or (a==="number") or (a==="undefined") { return 0;}
return a.length;
}
myarray=array[];
arrayCounter(myarray);
Manish Bhattarai
3,897 PointsThis is my script.
John Lawrence Salvador
418 PointsJohn Lawrence Salvador
418 PointsPlease include your script. :) Thank you.