title: Chunk a string every odd and even position
body: <p>I know nothing about javascript. </p>
  
  <p>Assuming the string "3005600008000", I need to find a way to multiply all the digits in the odd numbered positions by 2 and the digits in the even numbered positions by 1.</p>
  
  <p>This pseudo code I wrote outputs (I think) TRUE for the odd numbers (i.e. "0"), </p>
  
  <pre><code>var camid;
  var LN= camid.length;
  var mychar = camid.charAt(LN%2);
  
  var arr = new Array(camid);
  for(var i=0; i&lt;arr.length; i++) {
      var value = arr[i]%2;
      Alert(i =" "+value);
  }
  </code></pre>
  
  <p>I am not sure this is right: I don't believe it's chunking/splitting the string at odd (And later even) positions. </p>
  
  <p>How do I that? Can you please provide some hints?</p>
  
  <pre><code>/=================================================/
  </code></pre>
  
  <p>My goal is to implement in a web page a validation routine for a smartcard id number.</p>
  
  <p>The logic I am trying to implement is as follows:</p>
  
  <p>· 1) Starting from the left, multiply all the digits in the odd numbered positions by 2 and the digits in the even numbered positions by 1.</p>
  
  <p>· 2) If the result of a multiplication of a single digit by 2 results in a two-digit number (say "7 x 2 = 14"), add the digits of the result together to produce a new single-digit result ("1+4=5").</p>
  
  <p>· 3) Add all single-digit results together.</p>
  
  <p>· 4) The check digit is the amount you must add to this result in order to reach the next highest multiple of ten. For instance, if the sum in step #3 is 22, to reach the next highest multiple of 10 (which is 30) you must add 8 to 22. Thus the check digit is 8.</p>
  
  <p>That is the whole idea. Google searches on smartcard id validation returned nothing and I am beginning to think this is overkill to do this in Javascript...</p>
  
  <p>Any input welcome. </p>