Check if variable is a number in JavaScript