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

Unused variable report giving wrong context

Expand Messages
  • Erik Eckhardt
    I m using a library expects a callback function with certain parameters. I only am interested in the second parameter, but must have an unused first parameter.
    Message 1 of 3 , Jul 15, 2011
      I'm using a library expects a callback function with certain parameters. I
      only am interested in the second parameter, but must have an unused first
      parameter.

      with this code snippet:

      $.each(properties, function (index, value) { ...

      The "unused variable" report at the bottom of jslint incorrectly displayed

      *index* *166 * 'properties'

      which is not correct as the context is `each`.


      [Non-text portions of this message have been removed]
    • Douglas Crockford
      ... The context of index is an anonymous function that comes after properties . The report is right.
      Message 2 of 3 , Jul 15, 2011
        --- In jslint_com@yahoogroups.com, Erik Eckhardt <erik@...> wrote:
        >
        > I'm using a library expects a callback function with certain parameters. I
        > only am interested in the second parameter, but must have an unused first
        > parameter.
        >
        > with this code snippet:
        >
        > $.each(properties, function (index, value) { ...
        >
        > The "unused variable" report at the bottom of jslint incorrectly displayed
        >
        > *index* *166 * 'properties'
        >
        > which is not correct as the context is `each`.


        The context of index is an anonymous function that comes after 'properties'. The report is right.
      • Erik Eckhardt
        Apparently I misunderstood the purpose of the context variable. Thank you for setting me straight and sorry to waste your time. ... [Non-text portions of this
        Message 3 of 3 , Jul 15, 2011
          Apparently I misunderstood the purpose of the context variable. Thank you
          for setting me straight and sorry to waste your time.

          On Fri, Jul 15, 2011 at 4:37 PM, Douglas Crockford <douglas@...>wrote:

          > **
          >
          >
          > --- In jslint_com@yahoogroups.com, Erik Eckhardt <erik@...> wrote:
          > >
          > > I'm using a library expects a callback function with certain parameters.
          > I
          > > only am interested in the second parameter, but must have an unused first
          > > parameter.
          > >
          > > with this code snippet:
          > >
          > > $.each(properties, function (index, value) { ...
          > >
          > > The "unused variable" report at the bottom of jslint incorrectly
          > displayed
          > >
          > > *index* *166 * 'properties'
          > >
          > > which is not correct as the context is `each`.
          >
          > The context of index is an anonymous function that comes after
          > 'properties'. The report is right.
          >
          >
          >


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.