We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/fex-team/styleguide/blob/master/javascript.md#%E5%9D%97%E7%8A%B6%E4%BB%A3%E7%A0%81
The text was updated successfully, but these errors were encountered:
必须顶 if的强制大括号,不然以后加个逻辑很容易忽略。 而且现在我记得Sublime这种编辑器里你直接if后面回车就自动加上大括号了。
Sorry, something went wrong.
+1
+1 原来GMU貌似是强制的
想起来了,主要是考虑到这个case,独立一行可读性更强。
var noop = function() {};
var emptyObject = {};
很多时候我条件判断的时候只做一件事,我觉得还是不要强制的好。我建议如果 if / for 的执行只有一条语句的话,不写大括号需要强制写在一行,如果是多行,强制加大括号。
// good if (isIE) doForIE(); // bad if (isIE) doForIE(); // good if (isIE) { doForIE(); } // good if (isIE) { doForIE(); maskChrome(); }
如果只有一行我也倾向于 if (isIE) doForIE();这种写法,超过多行才强制用大括号。
if (isIE) doForIE();
2betop
No branches or pull requests
https://github.com/fex-team/styleguide/blob/master/javascript.md#%E5%9D%97%E7%8A%B6%E4%BB%A3%E7%A0%81
The text was updated successfully, but these errors were encountered: