JavaScript tofixed tylko wtedy, gdy dziesiętny
var formattedNumber = (x * 1.5).toFixed(2).replace(/[.,]00$/, "");
Weary Wildebeest
var formattedNumber = (x * 1.5).toFixed(2).replace(/[.,]00$/, "");