JavaScript Program to print word equivalent of a given number

Write a JavaScript program using switch statement to print word equivalent of a number from 0 to 9. For example, if user enters 3 then the output shown will be "three".



Source Code
<html>
<head>
    <title>Print number in word</title>
</head>
<body>
<script>
    var n = prompt("Enter any number from 0 to 9", "Enter number here");
    n = parseInt(n);

    switch(n)
    {
        case 0: document.write("ZERO"); break;
        case 1: document.write("ONE"); break;
        case 2: document.write("TWO"); break;
        case 3: document.write("THREE"); break;
        case 4: document.write("FOUR"); break;
        case 5: document.write("FIVE"); break;
        case 6: document.write("SIX"); break;
        case 7: document.write("SEVEN"); break;
        case 8: document.write("EIGHT"); break;
        case 9: document.write("NINE"); break;
        default: document.write("Plz enter no. from 0 to 9"); break;
    }
</script>
</body>
</html>
Output