Home > Back-end >  How to check the decimal position AngularJS
How to check the decimal position AngularJS

Time:09-16

I am working with a value such as var number = 23.8981 I need to check the 4th number after the decimal and determine if it is a number that is not 0. I am uncertain how to go about this check. I am new to angularjs so any help with this particular problem would be greatly appreciated.

CodePudding user response:

Could make use of some javascript logic like one below.

const number = 23.8981;
const fourthDigit = number * 10000 % 10;
console.log(fourthDigit);

  • Related