function abc(a) {
'use strict';
a = (a !== undefined) ? a : 'GET';
}
为什么会抛出如下异常?(不是错误,是不符合规范JSLint)
Expected '?' at column 8, not column 26.
a = (a !== undefined) ? a : 'GET';
line 2 column 30Expected ':' at column 8, not column 30.
a = (a !== undefined) ? a : 'GET';
JSLint对空白符(缩进)有明确规定
三元操作符的
?和:要换新行并增加4个空格的缩进。所以它要求?在第8列,:同理。所以正确的写法是: