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