split a sum into array javascript
<p>I have created a dice function that trows random dices and sum the value of them.</p>

<p>Now every number from 0-9 is connected to a class, so if i get number 4 it should call class " four"
So i created a switch from 0-9 .
But when i get a sum more than 9 its give me the default number, since the function dosent know that 11 is actually 2 numbers. 
I was wonder I its possible to split the numbers and put them into an array so when i pass it to the switch it gets med "one" "one" .</p>

<p>Any ideas ?</p>

<pre><code>var value = total;
    switch(this.value){
        case 1:
            value ="one";
            break
        case 2:
            value ="two";
            break
        case 3:
            value ="three";
            break
        case 4:
            value ="four";
            break
        case 5:
            value ="five";
            break
        case 6:
            value ="six";
            break
        case 7:
            value ="seven";
            break
        case 8:
            value ="eight";
            break
        case 9:
            value ="nine";
            break
        case 0:
            value ="zero";
            break
        default:
            value ="zero" 
    }
</code></pre>
