简体   繁体   English

jslint:var语句后的右括号

[英]jslint: Closing bracket after var statement

As a javascript newbie, I follow jslint suggestions when possible. 作为javascript新手,我尽可能遵循jslint建议。 Now here is something that doesn't make any sense to me. 现在,这对我来说毫无意义。

The following code is valid: 以下代码有效:

function func() {
    "use strict";
    var foo = function () {
        },
        bar = function () {

        };
}

And this is valid, too: 这也是有效的:

function func() {
    "use strict";
    var foo = function () {
    },
        bar = function () {

        };
}

Line 4 is different in these. 第4行在这些方面有所不同。 Is this actually valid or is it a bug? 这实际上有效还是错误?

Edit 20.02: The Question was not whether this is correct JavaScript or not. 编辑20.02:问题不是这是否正确的JavaScript。 It was whether this both is correct according to jslint. 根据jslint,这两者是否正确。 In this case there are two possibilities, where as usually there is only one way to write code 100% jslint-valid. 在这种情况下,有两种可能性,通常情况下,只有一种方法可以编写100%jslint有效的代码。

唯一的区别是缩进量,这完全是编码风格的问题,对代码的解析没有影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM