JavaScript开放式大括号在同一行 [英] JavaScript open brace in the same line
本文介绍了JavaScript开放式大括号在同一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我记得有一个约定/建议将开括号放在同一行,因为JavaScript添加分号或其他东西的方式。
I remember there is a convention/recommendation to put opening brace in the same line, because of the way JavaScript adds a semicolon or something.
//OK
function blah(){
};
//Probably not OK
function blah()
{
};
但我找不到相关来源来确认/否认这一点。
But I don't find a relevant source to confirm/deny this.
这是真的吗?或者只是一个神话?
Is this true? Or just a myth?
推荐答案
这篇关于优雅代码的文章给出了自动分号插入的一些解释,但是关于返回对象,而不是声明函数。
This post on Elegant Code gives some explanation of automatic semicolon insertion, but in regard to returning objects, not declaring functions.
这篇关于JavaScript开放式大括号在同一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文