title: How can I insert dashes between each 2 odds numbers and asterisks between even numbers in Javascript?
body: <p>How can I write a function that insert dashes ('-') between each two odd numbers and insert asterisks ('*') between each two even numbers?</p>
  <p>For example: if num is 4005467930 the output should be: 40054*67-9-30. I Did not count zero as an odd or even number.
  below is my code: I tried to use continue to loop over zero , but it didn't work. There is also dash('-') in the begining of the printed result. How can I overcome this</p>
  <pre><code>function StringChallenge(num) {
  
      let newString = num.toString();
      let result = '';
     
      for (let i = 0; i &lt;newString.length; i++) {
        let previous_number = newString[i-1];
        let current_number = newString[i];
  
        if(current_number === 0 || previous_number === 0 ){
          result += current_number
          continue
        } else
          if(previous_number % 2 == 0 &amp;&amp; current_number % 2 == 0) {
              result += &quot;*&quot; + current_number
              console.log(result)
          } else if(previous_number % 2 !== 0 &amp;&amp; current_number % 2 !== 0) {
              result += &quot;-&quot; + current_number
              console.log(result)
          } else {
              result += current_number
              console.log(result)
          }
          
          
      }
      return result
  }
  console.log(StringChallenge(4005467930))   // -4*0*054*67-9-30; I want it to be: 40054*67-9-30 //
  </code></pre>