0

I am new to js.I search on googled too, but I none worked for me.

I have a var num = 71.666666666

How can I limit this to 71.66

I tried this :

Math.tranc(num,2)     # 71

and 

Math.round(num.2)     # 72

And also plese suggest me if there are any other methods in js to do this.

Please help

  • 1
    Possible duplicate of [Round to at most 2 decimal places](http://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places) – Aaron Feb 22 '17 at 14:11

1 Answers1

2

Try this..

Math.round(num * 100) / 100

var num = 71.6666666;

a = Math.round(num * 100) / 100

console.log("output :",a);
Shivkumar kondi
  • 6,458
  • 9
  • 31
  • 58