JavaScript type checking