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

[CLOSED] Undetected variable

Expand Messages
  • Fred Lorrain
    Ok, thank you very much. I should have read your JavaScript recommendations before asking. What a shame .hasOwnProperty() is not documented in many JavaScript
    Message 1 of 4 , Apr 16, 2009
    • 0 Attachment
      Ok, thank you very much.
      I should have read your JavaScript recommendations before asking.

      What a shame .hasOwnProperty() is not documented in many JavaScript references

      --- In jslint_com@yahoogroups.com, "santini.alberto" <albertosantini@...> wrote:
      >
      > --- In jslint_com@yahoogroups.com, "Fred Lorrain" <yahoo@> wrote:
      > >
      > > The key variable is not detected.
      >
      > It is correct because there is an error in the snippet: the body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.
      >
      > ...
      > for (key in obj) {
      > if (obj.hasOwnProperty(key)) {
      > objLength++;
      > }
      > }
      > ...
      >
      > Regards,
      > Alberto
      >
    • Douglas Crockford
      ... Thanks. This has been fixed.
      Message 2 of 4 , Apr 17, 2009
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "Fred Lorrain" <yahoo@...> wrote:
        > for (key in obj) {

        > The key variable is not detected.

        Thanks. This has been fixed.
      Your message has been successfully submitted and would be delivered to recipients shortly.