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
Joseph Burdick
11,543 PointsReturn values, code challenge
Ok so I don't understand why this isn't working:
function arrayCounter(arr){
if (typeof arr === 'undefined' || 'number' || 'string'){
return 0;
}
return arr.length;
}
The error displayed is : "Bummer! If I pass in an array in to 'arrayCounter' of '1,2,3' I get 0 and not the number 3."

Keith Doyle
25,973 Pointsi apologize... code view.
if (typeof arr === 'undefined' || typeof array === 'number' || typeof array === 'string')

Joseph Burdick
11,543 Pointsfacepalm
Thanks for the help.
2 Answers

Chris Akers
2,527 PointsGreat job, Keith!

Keith Doyle
25,973 Points@Joseph Burdick, no worries! I did the same exact thing!
@Chris Akers, thanks!

john hennelly
Courses Plus Student 2,831 Pointshaving exact same issue thanks
Keith Doyle
25,973 PointsKeith Doyle
25,973 Pointsyou need to include the full conditional statement after each OR.
\ if (typeof arr === 'undefined' || typeof array === 'number' || typeof array === 'string')