How to get following inputs to bellow outputs
Input
1.0789
10.350
1.7777
Output
1.07
10.35
1.77
How to get following inputs to bellow outputs
Input
1.0789
10.350
1.7777
Output
1.07
10.35
1.77
Use Math.floor
to round the decimal places under the current value.
Example
Math.floor(1.0789 * 100) / 100
Working Fiddle
console.log(Math.floor(1.0789 * 100) / 100);
console.log(Math.floor(10.350 * 100) / 100);
console.log(Math.floor(1.7777 * 100) / 100);
console.log(Math.floor(12.34 * 100) / 100);
you have several methods for do this