Loading ...
Sorry, an error occurred while loading the content.

"Bad for in variable"

Expand Messages
  • Carlos Vadillo
    I am getting this message in my code and I cannot see what is wrong. Here is an excerpt of my code: function isValidConfig(config, reference) { var attribute;
    Message 1 of 2 , Feb 1, 2011
    • 0 Attachment
      I am getting this message in my code and I cannot see what is wrong. Here is an excerpt of my code:

      function isValidConfig(config, reference) {

      var attribute;
      ...

      try {
      for (attribute in reference) {
      if (reference.hasOwnProperty(attribute)) {
      checkPropertyType(attribute, config, reference[attribute], config[attribute]);
      checkPropertyValidator(attribute, config, reference[attribute], config[attribute]);
      }
      }
      } catch (e) {
      return false;
      }
      return true;
      }

      And I am getting this error message when using JSLint:
      Lint at line 118 character 18: Bad for in variable 'attribute'. Any ideas why I am getting the error? What do I need to do to avoid it?
    • abyssoft@ymail.com
      I was looking in to it for you, but with the snippet provided I was unable to reproduce.
      Message 2 of 2 , Feb 4, 2011
      • 0 Attachment
        I was looking in to it for you, but with the snippet provided I was unable to reproduce.


        --- In jslint_com@yahoogroups.com, "Carlos Vadillo" <carlos.vadillo@...> wrote:
        >
        > I am getting this message in my code and I cannot see what is wrong. Here is an excerpt of my code:
        >
        > function isValidConfig(config, reference) {
        >
        > var attribute;
        > ...
        >
        > try {
        > for (attribute in reference) {
        > if (reference.hasOwnProperty(attribute)) {
        > checkPropertyType(attribute, config, reference[attribute], config[attribute]);
        > checkPropertyValidator(attribute, config, reference[attribute], config[attribute]);
        > }
        > }
        > } catch (e) {
        > return false;
        > }
        > return true;
        > }
        >
        > And I am getting this error message when using JSLint:
        > Lint at line 118 character 18: Bad for in variable 'attribute'. Any ideas why I am getting the error? What do I need to do to avoid it?
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.