mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
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
This commit is contained in:
10
Maths/DecimalIsolate.js
Normal file
10
Maths/DecimalIsolate.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
Reference in New Issue
Block a user