function calcPrice(basePrice) { if (typeof(basePrice) !== 'number') { throw 'Price must be a number.'; } if (basePrice < 0) { basePrice *= -1; } return basePrice * 1.2; }