trim float js code example Example: javascript format float let x = 0.548 console.log(x.toFixed(2)); // 0.54