i'm writing a function and need to ensure that all of the inputs are correct before I do anything with them. one thing I need to do is check whether there are exactly 2 decimal points in a number. i can't figure out how to write this in an if/else condition.
for example:
2.22 = true
1.00 = true
10.32 = true
100.11 = true
12.1 = false
1.044 = false
I currently have the function checking that there is a decimal point, and that the value is a number like this:
else if (data === "" || !data.includes('.') || isNaN(data) || !data=.split(".")[1].length > 3)) {...}
how would I go about doing this??