JSLint Character Unexpected '.'

96 Views Asked by At

Atoms's JSLint report is complaining about an unexpected dot of the .toFixed function:

subTotal = (Math.round(subTotal * 100) / 100).toFixed(2);

at line 113, character 50 Unexpected '.'

The code works fine,

Question: Is this a fault with JSLint or have I coded something wrong?

Thanks

1

There are 1 best solutions below

0
kai zhu On BEST ANSWER

jslint doesn't like the dot "." after a naked, parenthesized expression. adding a Number in front of ( should fix the warning. the other common-case is adding a String in front of (.

subTotal = Number(Math.round(subTotal * 100) / 100).toFixed(2);