Why 1.toFixed(2) get 开发者_如何转开发syntax error while
var a = 1;
a.toFixed(2) 
won't.
Moreover, why does 1.1.toFixed(2) run alright?
1. starts a float so 1.toFixed() is incorrect syntax. You could use (1).toFixed() though.
1.1.toFixed() works fine because after 1.1 you are already in a float so the parser won't take . as the beginning of a float but as an object method call.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论