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

63Re: Missing semicolon

Expand Messages
  • Douglas Crockford
    May 30, 2008
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "ps_praveenkr" <ps.praveenkr@...>
      wrote:
      >
      > Hi,
      >
      > function myFunc() {
      > var v1 = { option: true };
      > var v2 = v1.option = false;
      > };
      >
      > JSLint throws the following error messages for the above code snippet:
      >
      > Error:
      >
      > Problem at line 3 character 21: Missing semicolon.
      >
      > var v2 = v1.option = false;
      >
      > Problem at line 3 character 22: Expected an identifier and instead saw
      > '='.
      >
      > var v2 = v1.option = false;
      >
      > Problem at line 3 character 22: Stopping, unable to continue. (50%
      > scanned).

      You are using an assignment expression in a confusing context. Wrap it
      in parens to show that you are doing it intentionally.

      function myFunc() {
      var v1 = { option: true };
      var v2 = (v1.option = false);
      }
    • Show all 5 messages in this topic