Eclipse中针对JavaScript代码的“缺少分号”警告 [英] 'Missing semicolon' warning in Eclipse for JavaScript code

查看:292
本文介绍了Eclipse中针对JavaScript代码的“缺少分号”警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse为以下代码的第4行提供了Missing decmicolon警告:

Eclipse gives me the warning 'Missing semicolon' for line 4 of the following code:

const C = 'b';
function foo() {
    alert('x');
}

它不适用于以下代码:

//const C = 'b';
function foo() {
    alert('x');
}

对于以下内容,它给了我两个警告:

For the following it gives me two warnings:

const C = 'b';
function foo() {
    alert('x');
};

此行有多个标记


  • 不必要的分号

  • 缺少分号

有没有办法制作Eclipse用'const'忽略我的行?或者有另一种方法可以解决我的问题吗?

Is there a way to make Eclipse ignore my lines with 'const'? Or is there another way to solve my problem?

我正在使用:

用于JavaScript Web开发人员的Eclipse IDE 。

版本:Indigo服务版本1

构建ID:20110916-0149

Eclipse IDE for JavaScript Web Developers.
Version: Indigo Service Release 1
Build id: 20110916-0149

推荐答案

JavaScript中只提出了 const 。使用

There is only a proposed const in JavaScript. Use

var C = 'b';

实际上,显然有一个const,但并不是所有浏览器都支持它并且不会很好出于这个原因使用。

Actually, there is a const apparently, but it is not supported by all browsers and would not be good to use for that reason.

Eclipse给你警告的原因是它无法识别 const 这是Eclipse中的已知错误。

The reason Eclipse is giving you the warning is that it does not recognize const which is a known bug in Eclipse.

您可以阅读如何忽略 使用JavaScript const会在关联... 中显示缺少分号。

You can read how to ignore the errors in Use of JavaScript const gives "missing semicolon" in associative....

这篇关于Eclipse中针对JavaScript代码的“缺少分号”警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆