When i was working on core php project and i need to work with float value. Like i require to fixed decimal point with two digit after point. So i did search on google and found the tofixed() of javascript. But when i try and checked on my fire but, it say tofixed() is not a function. I thought what was wrong and i did try many way.
However, Finally i got what is issue and found the best solution. But i did simply use like as bellow example:
var myVal = $(".myfloat").val();
myVal = myVal.tofixed(2);
But above code was not working because i require to use "parseFloat" before use tofixed(), So i did simply use as bellow code:
Solution:
var myVal = $(".myfloat").val();
myVal = parseFloat(myVal).tofixed(2);
I hope you found your solution....
Do you like below Tutorials ?
- Angular Json Pipe Example | Json Pipe in Angular 9/8/7
- Angular Slice Pipe Example | Slice Pipe in Angular 9/8/7
- Angular Uppercase Pipe Example | Uppercase Pipe in Angular 9/8/7
- Angular LowerCase Pipe Example | LowerCase Pipe in Angular 9/8/7
- Angular Titlecase Pipe Example | Titlecase Pipe in Angular 9/8/7
- Angular KeyValue Pipe Example | KeyValue Pipe in Angular 9/8/7
- Call Method from One Component to Another Component in Angular
- Angular Push Object into Array Example