Coding convention in [removed] use of spaces between parentheses

前端 未结 7 1120
孤城傲影
孤城傲影 2021-02-14 12:54

According to JSHint, a Javascript programmer should not add a space after the first parenthesis and before the last one.

I have seen a lot of good Javascript libraries t

7条回答
  •  你的背包
    2021-02-14 13:48

    Standards are important and we should follow them, but not blindly. To me, this question is about that syntax styling should be all about readability.

    this.someMethod(toString(value),max(value1,value2),myStream(fileName));
    
    this.someMethod( toString( value ), max( value1, value2 ), myStream( fileName ) );
    

    The second line is clearly more readable to me.

    In the end, it may come down to personal preference, but I would ask those who prefer the 1st line if they really make their choice because "they are used it" or because they truly believe it's more readable.

    If it's something you are used to, then a short time investment into a minor discomfort for a long term benefit might be worth the switch.

提交回复
热议问题