DEV Community

Discussion on: JS Test #7: Is this an array?

Collapse
 
lionelrowe profile image
lionel-rowe

Array.isArray(array) or array instanceof Array would both work 😉

Collapse
 
coderslang profile image
Coderslang: Become a Software Engineer

Thanks for pointing it out! The main point of these code snippets is to show beginner devs their weaknesses. In my experience, at least half of the newbie devs don't know how exactly typeof works.