JavaScript values have types even though variables do not need type annotations. Knowing whether a value is text, a number, or a boolean helps you predict how operators will behave.
const quantityText = "4";
const quantity = Number(quantityText);
console.log(typeof quantityText); // "string"
console.log(quantity + 1); // 5Inspect values with typeof, convert deliberately with Number and String, and recognise NaN when a conversion fails. Explicit conversions keep inputs such as form fields from producing surprising results.