Files
JavaScript/Maths/DecimalIsolate.js
Dumby 7c2f19b691 merge: Rename 2 filenames to follow PascalCase (#816)
* Added LucasSeries

* Added more tests and renamed function

* Changed RangeError to TypeError

* Added Aliquot Sum and tests

* Fix ALiquot tests, need to learn how to use Jest

* Added some explanation for the Aliquot sum

* Change file names of DecimalIsolate & IsOdd to Pascal case
2021-10-26 16:56:45 +05:30

11 lines
291 B
JavaScript

/*
* function isolates the decimal part of a number.
* Take the number and subtract it from the floored number.
* Return the result.
*/
export const decimalIsolate = (number) => {
const ans = parseFloat((number + '').replace(/^[-\d]+./, '.'))
return isNaN(ans) === true ? 0 : ans
}