Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>a. How best to remove the global variables using </p> </blockquote> <p>Wrap it in an anonymous function and assign it to the form as a submit listener.</p> <blockquote> <p>b. jsLint recommends "use strict", so I added it, but im not sure what it does. any good ref's? </p> </blockquote> <p>Don't bother. It's just a buzz-word for those trying to be hip. You can't use strict mode features on the general web because way too many browsers don't support them. You can use it with otherwise compliant ES 3 code, but it's only useful as a debugging tool for errors that should have been found during testing anyway (e.g. calling constructors without new).</p> <p>No c?</p> <blockquote> <p>d. Generally, feel free to rip this code apart (cuz I AM trying to learn) but please explain my errors in noob-speak :)</p> </blockquote> <pre><code>&gt; $rdoGroup = [], // an empty array which will be used to hold </code></pre> <p>You seem to be using $ to indicate a variable that references a jQuery object, but <em>$rdoGroup</em> is just an array. That may be confusing later.</p> <pre><code>&gt; $rdoGroup.push($(this).attr("name")); </code></pre> <p>The $ function is very expensive, don't use it if you don't need to. Standard HTML attributes are available in all browsers as DOM properties, so:</p> <pre><code> $rdoGroup.push(this.name); </code></pre> <p>Is up to 100 times more efficient, depending on the browser.</p> <pre><code>&gt; for (i = 0; i &lt; $rdoGroup.length; i++) { &gt; if ($rdoGroup[c].toString() !== $(this).attr("name").toString()) { </code></pre> <p>The values assigned to <em>$rdoGroup</em> are strings, calling their <em>toString</em> method is redundant.</p> <p>As above, use <code>this.name</code>. The name property is a string, so no need for <em>toString</em>.</p> <p>I think the exercise would be easier without jQuery, which seems to be getting in the way far more than helping. If you are trying to learn javascript, I'd suggest that you learn javascript without using any library. </p> <p>Once you are reasonably confident with using javascript, then you are far better equipped to use a library for the things the library is good with, and not using it for the things it isn't good at.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload