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:
- 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.
- 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
- 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;
精彩评论