- 主题:同事不知道从哪里学的习惯
世界上有两种js编码风格,一种写; 一种不写;
(不能被压缩?没这回事)
http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
http://dailyjs.com/2012/01/19/semicolons/
tjholowaychuk o 3 years ago
yeah bottom-line is that the only ugly code is inconsistent code, if you are consistent between projects then it's great to experiment and evolve your style choices. Almost any language CAN look good, it's just the people writing it that make it look bad
tj大神说保持一致的风格就好。
【 在 hgoldfish 的大作中提到: 】
: 1. js 不打 ; 了
: 2. 早早就写了 return 语句:
: return $scope.brand='ksldf', $scope.user={}
: ...................
--
FROM 113.106.72.*
我就是不写分号的,没吃过亏。压缩也都很顺利。
你是写分号还吃过亏,不如转到不写分号的阵营。
另外不写分号还可以少按很多次键盘
,这么一比较写分号简直毫无理由。
【 在 dreamingGirl 的大作中提到: 】
: 不加分号compress可能出问题,加上肯定不会,为何不加。
: 这个吃过多次亏了,开发环境没事,到发布后compress之后的代码有错误,遇到多次了。
: 估计任何公司都不会出分号不加的情形的规范吧。
: ...................
--
FROM 45.56.87.*
但是 是在 “写分号代码风格”下出的“不写分号”问题,对吧?
转到 “不写分号代码风格”,也许就不会出“不写分号”问题了啊
当然这都是瞎扯,我觉得出问题的是写代码和执行代码风格的人,而不是代码风格
看下三位大神的代码风格
http://dailyjs.com/2012/01/12/style/
tj (author of Express, Jade, Stylus, Koa, Mocha, and 500+ others libs) 写分号,逗号前置
Isaac Z. Schlueter (author of npm)不写分号的主要推动者
Ryan Dahl, creator of Node 写分号
【 在 dreamingGirl 的大作中提到: 】
: 当然是不写分号出的问题啊。
--
修改:zxdong262 FROM 45.56.87.*
FROM 45.56.87.*