Совет. Вы можете получить значение элемента ввода в виде числа. const quantityInput = document.getElementById('quantity-input'); let quantity; // Bad: parseFloat() converts the string to a number quantity = parseFloat(quantityInput.value); // Good: returns a numeric value quantity = quantityInput.valueAsNumber;JavaScriptCopy Числа JavaScript