I am currently faced with the task of filtering out numbers that are larger than 9e+65
(65 zeros). I have to create a function that takes a number as input and returns a boolean value based on whether it meets the criteria. This function should be able to handle both standard formatted numbers (42342
) and scientific notation (1e5
).
Here is my current approach:
const checkIfGreaterThan65Zeros = (num: number):boolean =>
num.toString().includes("e+") ?
Number(value.toString().split('e+')[1]) > 65 : false
Unfortunately, this implementation has been deemed dirty by the reviewer.