garder 2 chiffres après virgule javascript code example Example: arrondi js let x = 2.960024578; let res = x.toFixed(2); console.log(res); //2,96