繁体   English   中英

JSLint:意外结束

[英]JSLint: unexpected end

$.fn.hasScrollBar = function () {
    "use strict";

    return this.get(0).scrollHeight > this.height();
}

JSLint抱怨说:

Unexpected '(end)'.
}
line 5 character 1

任何想法有什么问题吗?

由于它是一个函数表达式(而不是函数声明),因此应以分号结尾:

$.fn.hasScrollBar = function () {
    "use strict";

    return this.get(0).scrollHeight > this.height();
}; //<-- Semi-colon here

JSLint抱怨“意外结束”,因为它不希望在结束}字符处遇到输入的结尾。

暂无
暂无

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

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