JavaScript: type checks