title: DashInsert Coderbyte Challenge - Why does arr[i]%2===1 work?
body: <p>The Coderbyte problem is: 
  <em>Using the JavaScript language, have the function DashInsert(str) insert dashes ('-') between each two odd numbers in str. For example: if str is 454793 the output should be 4547-9-3. Don't count zero as an odd number.</em></p>
  
  <p>So when the input is 99946, the output should be 9-9-946. </p>
  
  <p>I had this solution, which wouldn't quite work: </p>
  
  <pre><code>function DashInsert(num) {
  var arr = num.toString().split('');
  var i = 0;
  while(i &lt; arr.length-1){
  if( arr[i]%2 !==0 &amp;&amp; arr[i+1]%2 !==0){ 
  arr.splice(i+1,0,'-'); 
  }
  i++
  }
  return arr.join(''); 
  }
  </code></pre>
  
  <p>Then I found this similar answer: </p>
  
  <pre><code>function DashInsert(num) {
  var arr = num.toString().split('');
  
  var i = 0
  
  while(i &lt; arr.length-1){
  if( arr[i]%2===1 &amp;&amp; arr[i+1]%2===1){ 
  arr.splice(i+1,0,'-'); 
  }
  i++
  }
  
  return arr.join(''); }
  str = 99946;
  alert(DashInsert(str)); 
  </code></pre>
  
  <p>Can anyone explain why it should be arr[i]%2===1? </p>