I noticed that if you put a space character before .toFixed
method, it will work without errors. I understand why it's work with a parenthesis (2).toFixed(2)
, but why does it work with space?
console.log(2 .toFixed(2))
// 2.00
console.log(2.toFixed(2))
// Uncaught SyntaxError: Invalid or unexpected token
Please leave links to any information about this. Thanks.