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

Re: [jslint] init of for

Expand Messages
  • Marcel Duran
    That s true, however html collections are considered live which means they re automatically updated when the underlying document is changed. ... --
    Message 1 of 8 , Feb 25, 2013
    • 0 Attachment
      That's true, however html collections are considered live which means
      they're automatically updated when the underlying document is changed.

      On Monday, February 25, 2013, Mike On Mobile wrote:

      > **
      >
      >
      > At one time it was considered best practice to store the array length in a
      > local variable and use that in the comparison . That was because the object
      > property lookup was significantly more expensive than using the local
      > variable. However, recent JavaScript engines such as v8 reduce the
      > performance gap so greatly that the benefit of this optimization is
      > negligible. But it still makes a big difference in ie8 iirc.
      >
      > Jonas Trollvik jonas@... <javascript:_e({}, 'cvml',
      > 'jonas%40weightpoint.se');>> wrote:
      >
      > >What is the benefit of caching the array length here?
      > >
      > >I doubt it has any effect on performance.
      > >
      > >function f(an_array) {
      > >'use strict'
      > >var i;
      > >for (i = 0; i < an_array.length; i += 1) {
      > >// operate on an_array[i]
      > >}
      > >}
      > >
      > >looks like it is a lot cleaner and easier to read.
      > >
      > >2013/2/25 Heinz Rasched raschedh@... <javascript:_e({}, 'cvml',
      > 'raschedh%40yahoo.com');>>
      > >
      > >> **
      > >>
      > >>
      > >> I knew that you wouldn't like that.
      > >>
      > >>
      > >> > (; looks like a mistake.
      > >>
      > >> That depends on the context of the `(;'
      > >>
      > >>
      > >> > Do not use forms that look like mistakes.
      > >>
      > >> I do not.
      > >>
      > >>
      > >> > To make it easier to find the needle, make your program look less
      > like a
      > >> haystack.
      > >>
      > >> My programs are far from looking like that.
      > >> I never look for needles in them.
      > >>
      > >> Anyhow, thanks for the consideration.
      > >>
      > >> Of course, I'll pledge myself to JsLint's teachings,
      > >> and will keep on writing
      > >>
      > >> (i = 0, n = heretic.length; [...]
      > >>
      > >>
      > >>
      > >
      > >
      > >[Non-text portions of this message have been removed]
      > >
      > >
      > >
      > >------------------------------------
      > >
      > >Yahoo! Groups Links
      > >
      > >
      > >
      >
      >


      --
      @marcelduran


      [Non-text portions of this message have been removed]
    • Heinz Rasched
      ... Because having been blamed with your usual accusations yada yada, I take the liberty to thank you for the context coloring stuff in jslint ! Not because i
      Message 2 of 8 , Feb 26, 2013
      • 0 Attachment
        > (; looks like a mistake. Do not use forms that look like mistakes.
        >
        > To make it easier to find the needle, make your program look less like a haystack.

        Because having been blamed with your usual accusations yada yada,
        I take the liberty to thank you for the context coloring stuff in jslint !

        Not because i use it, but because of the heresy of yours, that
        the usual syntax highlighting is for children, which I found
        an inspiring thought to play with in my mind.

        So I switched mine off for all languages a month ago.

        I'll never switch it on again.

        Thank you !
      Your message has been successfully submitted and would be delivered to recipients shortly.