Say I'm creating a function to add some numbers together, and I want to verify they are all actually numbers.
I am doing this:
function addNumbers(x, y) {
if (typeof x == 'number' || typeof y == 'number') {
// do something..
}
}
It seems unpractical if I had more than two numbers. What would be a better way to check for multiple numbers?
addNumbersfunction with those values. We can help you a lot quicker that way.