Skip to content
Advertisement

How do you check for a type in an array?

I need to tell the program to search an array(that’s meant to be only numbers) if it contains any element that’s a string.

Also, the array is made up of the arguments to a function. Can someone please help? I’ve been trying to figure this out for at least an hour! This is what i did so far:

JavaScript

Advertisement

Answer

You’re looking for the function isNaN

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement