The max() method returns the number with the highest value.
When decreasing the product QTY, it's used to keep the lowest value by using Math.max().
For example, if you want the lowest value to be 1, it should be below.
Math.max(1, qty) : if qty is less than 1, return 1.
max()
method returns the number with the highest value. When decreasing the product QTY, it's used to keep the lowest value by using Math.max(). For example, if you want the lowest value to be 1, it should be below.Math.max(1, qty) : if qty is less than 1, return 1.
$qty.val(Math.max(
lowestNum
, parseInt($qty.val()) + adj)).trigger('change');