Counting number of holes in a number
<p>I'm trying to figure out how to count the number of "holes" in a number. That is, where 8 has two holes and 0, 4, 6, 9 have one hole and the rest have none. </p>

<p>For some reason I'm getting a return of undefined and I'm pulling my hair out over it. Am I missing something?</p>

<pre><code>var numOfHoles = 0;

   for (i = 0; i &lt; num.length; i++) {

   if (num === 8) {
       numOfHoles += 2; 
      }
       else if (num === 0 || num === 4 || num === 6 || num === 9) {
           numOfHoles++;
    }
     else
        numOfHoles;
  }
    console.log(numOfHoles);
}
</code></pre>