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

please help to understand problems reports

Expand Messages
  • qmaxa
    I m not an expert in JS coding, and this problems looks esoteric for me. The body of a for in should be wrapped in an if statement to filter unwanted
    Message 1 of 3 , Sep 20, 2009
    • 0 Attachment
      I'm not an expert in JS coding, and this problems looks esoteric for me.

      "The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype."
      <code>
      for(var c in this.colorcount.onboard) {
      set_count_onboard(c,this.colorcount.onboard[c]);
      }
      </code>
      the colorcount = { onboard: {'R':0, 'G':0, 'B':0, 'Y':0, 'M':0 }, blown: {'R':0, 'G':0, 'B':0, 'Y':0, 'M':0 } };

      Another problem:
      "Be careful when making functions within a loop. Consider putting the function in a closure."
      <code>
      var h = m.map(function(e){return{s: e.s, d: e.d};});
      </code>

      Thanks in advance.
    • Noah Sussman
      ... Then you want the Rhino Book (JavaScript: The Definitive Guide) http://oreilly.com/catalog/9780596000486/ ... See
      Message 2 of 3 , Sep 20, 2009
      • 0 Attachment
        On Sun, Sep 20, 2009 at 10:02 AM, qmaxa <qwiglydee@...> wrote:
        > I'm not an expert in JS coding,

        Then you want "the Rhino Book" (JavaScript: The Definitive Guide)
        http://oreilly.com/catalog/9780596000486/

        > this problems looks esoteric for me.
        >
        > "The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype."

        See http://yuiblog.com/blog/2006/09/26/for-in-intrigue/

        > Another problem:
        > "Be careful when making functions within a loop. Consider putting the function in a closure."

        For a quick solution, see
        http://www.cjboco.com/post.cfm/javascript-and-i-need-some-closure

        For an explanation of the problem, see
        http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/54ab90e2d778dc14

        --
        Noah Sussman
        nerdabout.com
        noah at one more bug dot com

        Software is fiction, it is imagination.  Not many rules apply.
                      -- Richard Gabriel
      • qmaxa
        Thank you for explanations and references. Already got caught in both of these problems. Now it is much cleaner :) The book is found and awaits reading.
        Message 3 of 3 , Sep 22, 2009
        • 0 Attachment
          Thank you for explanations and references.

          Already got caught in both of these problems.
          Now it is much cleaner :)

          The book is found and awaits reading.
        Your message has been successfully submitted and would be delivered to recipients shortly.