Coding convention in [removed] use of spaces between parentheses

前端 未结 7 1110
孤城傲影
孤城傲影 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:54

    I use the second (no space) style most of the time, but sometimes I put spaces if there are nested brackets - especially nested square brackets which for some reason I find harder to read than nested curved brackets (parentheses). Or to put that another way, I'll start any given expression without spaces, but if I find it hard to read I insert a few spaces to compare, and leave 'em in if they helped.

    Regarding JS Hint, I wouldn't worry- this particular recommendation is more a matter of opinion. You're not likely to introduce bugs because of this one.

提交回复
热议问题