开发者

JavaScript error in aptana

Aptana is showing error at this line:

var myVar = myVa开发者_如何学Gor1 = myVar2;

although when I deploy this script it works fine in FF or IE.

EDIT : it is showing an error on the second = sign, it is expecting a; instead got = sign.


That looks like an error coming from the JSLint JavaScript Validator. It's most likely complaining because myVar1 is not being declared with "var". You have a couple of options:

  1. Under Preferences->Aptana->Validation you can select "JavaScript" and turn off JSLint JavaScript Validator. There is a Mozilla JavaScript Validator that isn't as strict.
  2. Add a filter on that same pref page to effectively ignore that type of error. I think you only need a substring from the error message like "was not declared correctly", for example
  3. You can define separate var declarations as below:

Samples:

// version 1
var myVar = myVar2,
    myVar1 = myVar2;

or

// version 2
var myVar = myVar2;
var myVar1 = myVar2;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜