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