Understanding Type Coercion in JavaScript